1000 |
It is possible to search for an item ( inside the Editor ), case insensitive
Grid1->BeginUpdate(); Exgridlib_tlb::IEditorPtr var_Editor = Grid1->Columns->Add(L"DropDownList")->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::DropDownListType; var_Editor->AddItem(1,L"One",TNoParam()); var_Editor->AddItem(2,L"Two",TNoParam()); var_Editor->AddItem(3,L"Three",TNoParam()); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant(Grid1->Columns->get_Item(TVariant(0))->Editor->get_FindItem(TVariant(">ONE")))); var_Items->AddItem(TVariant(Grid1->Columns->get_Item(TVariant(0))->Editor->get_FindItem(TVariant(">ThRee")))); var_Items->AddItem(TVariant(Grid1->Columns->get_Item(TVariant(0))->Editor->get_FindItem(TVariant("ONE")))); var_Items->AddItem(TVariant(Grid1->Columns->get_Item(TVariant(0))->Editor->get_FindItem(TVariant(">tWo")))); Grid1->EndUpdate(); |
999 |
The text after the BR-tag is in same line as the text before the BR-tag (entire column)
Grid1->BeginUpdate(); Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exHLines; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Default"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(false)); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("This is the first line.<br>This is the second line.")); var_Items->AddItem(TVariant("This is the first line.<br>This is the second line.")); var_Items->AddItem(TVariant("This is the first line.<br>This is the second line.")); Grid1->EndUpdate(); |
998 |
The text after the BR-tag is in same line as the text before the BR-tag (individual)
Grid1->BeginUpdate(); Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exHLines; Grid1->Columns->Add(L"Default"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValueFormat(TVariant(var_Items->AddItem(TVariant("This is the first line.<br>This is the second line."))),TVariant(0),Exgridlib_tlb::ValueFormatEnum::exHTML); long h = var_Items->AddItem(TVariant("<b>This is the first line.<br>This is the second line.</b>")); var_Items->set_CellValueFormat(TVariant(h),TVariant(0),Exgridlib_tlb::ValueFormatEnum::exHTML); var_Items->set_CellSingleLine(TVariant(h),TVariant(0),Exgridlib_tlb::CellSingleLineEnum::exCaptionWordWrap); var_Items->set_CellValueFormat(TVariant(var_Items->AddItem(TVariant("This is the first line.<br>This is the second line."))),TVariant(0),Exgridlib_tlb::ValueFormatEnum::exHTML); Grid1->EndUpdate(); |
997 |
Can I disable an item once the user selects a new value into a different item
// Change event - Occurs when the user changes the cell's content. void __fastcall TForm1::Grid1Change(TObject *Sender,Exgridlib_tlb::HITEM Item,long ColIndex,Variant * NewValue) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_EnableItem(var_Items->get_ItemByIndex(1),false); } Grid1->FreezeEvents(true); Grid1->BeginUpdate(); Grid1->ScrollBySingleLine = true; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->Columns->Add(L"Q"); Grid1->Columns->Add(L"A"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h1 = var_Items->AddItem(TVariant("What's your gender?")); Exgridlib_tlb::IEditorPtr var_Editor = var_Items->get_CellEditor(TVariant(h1),TVariant(1)); var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::DropDownListType; var_Editor->AddItem(1,L"Male",TNoParam()); var_Editor->AddItem(0,L"Female",TNoParam()); var_Items->set_CellValue(TVariant(h1),TVariant(1),TVariant(1)); long h2 = var_Items->AddItem(TVariant("What's pet name?")); var_Items->set_CellValue(TVariant(h2),TVariant(1),TVariant("This is my pet favorite long long long name, that shoul break the line in multiple pieces")); var_Items->set_CellSingleLine(TVariant(h2),TVariant(1),Exgridlib_tlb::CellSingleLineEnum::exCaptionWordWrap); Grid1->EndUpdate(); Grid1->FreezeEvents(false); |
996 |
How can I get a row expanded / enlarged to fit the cell's text (entire column)
Grid1->BeginUpdate(); Grid1->ScrollBySingleLine = true; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->Columns->Add(L"Q"); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"A"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(false)); Exgridlib_tlb::IEditorPtr var_Editor = var_Column->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::MemoType; var_Editor->Appearance = Exgridlib_tlb::InplaceAppearanceEnum::SingleApp; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h1 = var_Items->AddItem(TVariant("What's name?")); var_Items->set_CellValue(TVariant(h1),TVariant(1),TVariant("This is my pet favorite long long long name, that shoul break the line in multiple pieces")); long h2 = var_Items->AddItem(TVariant("What's your pet name?")); var_Items->set_CellValue(TVariant(h2),TVariant(1),TVariant("This is my pet favorite long long long name, that shoul break the line in multiple pieces")); Grid1->EndUpdate(); |
995 |
How can I get a row expanded / enlarged to fit the cell's text (individual cell)
Grid1->BeginUpdate(); Grid1->ScrollBySingleLine = true; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->Columns->Add(L"Q"); Grid1->Columns->Add(L"A"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h1 = var_Items->AddItem(TVariant("What's name?")); var_Items->set_CellValue(TVariant(h1),TVariant(1),TVariant("This is my pet favorite long long long name, that shoul break the line in multiple pieces")); long h2 = var_Items->AddItem(TVariant("What's your pet name?")); Exgridlib_tlb::IEditorPtr var_Editor = var_Items->get_CellEditor(TVariant(h2),TVariant(1)); var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::MemoType; var_Editor->Appearance = Exgridlib_tlb::InplaceAppearanceEnum::SingleApp; var_Items->set_CellValue(TVariant(h2),TVariant(1),TVariant("This is my pet favorite long long long name, that shoul break the line in multiple pieces")); var_Items->set_CellSingleLine(TVariant(h2),TVariant(1),Exgridlib_tlb::CellSingleLineEnum::exCaptionWordWrap); Grid1->EndUpdate(); |
994 |
InsertControlItem / UserEditor / A2X:
Grid1->BeginUpdate(); Grid1->BackColor = RGB(240,240,240); Grid1->ConditionalFormats->Add(L"1 = 1",TNoParam())->Bold = true; Grid1->Columns->Add(L"Type")->Alignment = Exgridlib_tlb::AlignmentEnum::RightAlignment; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("1. A ProgID such as \"MSCAL.Calendar.7\"")); var_Items->set_ItemDivider(h,0); long hX = var_Items->InsertControlItem(0,L"MSCAL.Calendar",TVariant("")); var_Items->get_ItemObject(hX)->BackColor = RGB(255,255,255); h = var_Items->AddItem(TVariant("2. A CLSID such as \"{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}\"")); var_Items->set_ItemDivider(h,0); hX = var_Items->InsertControlItem(0,L"{0036F83C-D892-4B7B-AA0B-BEDD8D16A738}",TVariant("")); h = var_Items->AddItem(TVariant("3. A URL such as \"http://www.exontrol.com\"")); var_Items->set_ItemDivider(h,0); hX = var_Items->InsertControlItem(0,L"http://www.exontrol.com",TVariant("")); h = var_Items->AddItem(TVariant("4. A reference to an Active document such as \"file://\\\\Documents\\MyDoc.doc\"")); var_Items->set_ItemDivider(h,0); hX = var_Items->InsertControlItem(0,L"file://C:\\empesting.xml",TVariant("")); h = var_Items->AddItem(TVariant("5.A fragment of HTML such as \"MSHTML:<HTML><BODY>This is a line of text</BODY></HTML>\"")); var_Items->set_ItemDivider(h,0); hX = var_Items->InsertControlItem(0,L"MSHTML:<HTML><BODY>This is a <b>line of</b> text</BODY></HTML>",TVariant("")); var_Items->set_ItemHeight(hX,56); h = var_Items->AddItem(TVariant("6.Anything, if it is preffixed by \"A2X:\"")); var_Items->set_ItemDivider(h,0); hX = var_Items->InsertControlItem(0,L"A2X:TOC24.Toc24Ctrl.1",TVariant("")); Grid1->EndUpdate(); |
993 |
How do I add a RichTextBox editor
|
992 |
Is it possible to trap a double-click event on a specific cell and when that happens, to set the cell to a specific value
// DblClick event - Occurs when the user dblclk the left mouse button over an object. void __fastcall TForm1::Grid1DblClick(TObject *Sender,short Shift,int X,int Y) { long h = Grid1->ItemFromPoint[-1,-1,c,hit]; OutputDebugString( PChar(Grid1->Items->get_CellValue(TVariant(h),TVariant(c))) ); } Grid1->BeginUpdate(); Grid1->HeaderAppearance = Exgridlib_tlb::AppearanceEnum::Etched; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->Columns->Add(L"C1"); Grid1->Columns->Add(L"C2"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 1"))),TVariant(1),TVariant("Item 2")); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 3"))),TVariant(1),TVariant("Item 4")); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 5"))),TVariant(1),TVariant("Item 6")); Grid1->EndUpdate(); |
991 |
How can I display dates in DD/MM/YYYY format
Grid1->BeginUpdate(); Grid1->ScrollBySingleLine = false; Grid1->Columns->Add(L"Date"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_ItemDivider(var_Items->AddItem(TVariant("Different Date Formats")),0); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"((shortdateF(value) mid 4) left 2) + `/` + (shortdateF (value) left 2) + `/` + (shortdateF (value) right 4)"); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"(1 array (0:=(shortdateF(value) split `/`))) + `/` + (0 array (=:0) ) + `/` + (2 array (=:0) )"); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"((`0` + day(value) ) right 2) + `/` + ((`0` + month(value) ) right 2) + `/` + year(value)"); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"day(value) + `/` + month(value) + `/` + year(value)"); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"year(value) + ` - ` + day(value) + ` - ` + month(value)"); long h = var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double())); var_Items->set_ItemHeight(h,24); var_Items->set_CellValueFormat(TVariant(h),TVariant(0),Exgridlib_tlb::ValueFormatEnum::exHTML); var_Items->set_FormatCell(TVariant(h),TVariant(0),L"`<b>` + year(value) + `</b><off -4> ` + day(value) + ` - ` + month(value)"); var_Items->set_ItemDivider(var_Items->AddItem(TVariant("Predefined Date Formats")),0); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"value"); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"shortdateF(value)"); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"shortdate(value)"); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(TDateTime(1971,12,1).operator double()))),TVariant(0),L"longdate(value)"); Grid1->EndUpdate(); |
990 |
I have noticed that the column gets resized once I release the mouse. I have a column that displays multiple-lines cells, and the text gets wrapped only when user releases the mouse. Is it possible to get resized contiguously as I had before
Grid1->BeginUpdate(); Grid1->ScrollBySingleLine = false; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exVLines; Grid1->ColumnsAllowSizing = true; Grid1->Columns->Add(L"Column A (cont)")->set_Def(Exgridlib_tlb::DefColumnEnum::exColumnResizeContiguously,TVariant(true)); Grid1->Columns->Add(L"Column 1"); Grid1->Columns->Add(L"Column B (cont)")->set_Def(Exgridlib_tlb::DefColumnEnum::exColumnResizeContiguously,TVariant(true)); Grid1->Columns->Add(L"Column 2"); Grid1->EndUpdate(); |
989 |
How do I get the column from cursor, when it hovers the empty portion of the items section
|
988 |
How do I add items once the user clicks the empty area
// Click event - Occurs when the user presses and then releases the left mouse button over the grid control. void __fastcall TForm1::Grid1Click(TObject *Sender) { long i = Grid1->ItemFromPoint[0,-1,c,hit]; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(i))),TVariant(1),TVariant(c)); } Grid1->BeginUpdate(); Grid1->Columns->Add(L"Number of Items to Add"); Grid1->Columns->Add(L"Click on Column"); Grid1->EndUpdate(); |
987 |
Is there any option to stop events
// AddItem event - Occurs after a new Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { OutputDebugString( L"AddItem event is fired only if FreezeEvents(False) is called" ); } Grid1->FreezeEvents(true); Grid1->BeginUpdate(); Grid1->DefaultItemHeight = 24; Grid1->Columns->Add(L"Task"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h1 = var_Items->AddItem(TVariant("Task 1")); long h2 = var_Items->AddItem(TVariant("Task 2")); Grid1->EndUpdate(); Grid1->FreezeEvents(false); |
986 |
How can I include the child items, when a filter is applied
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = true; Grid1->ContinueColumnScroll = false; Grid1->MarkSearchColumn = false; Grid1->SearchColumnIndex = 1; Grid1->Indent = 16; Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->FilterBarPromptVisible = Exgridlib_tlb::FilterBarVisibleEnum::exFilterBarPromptVisible; Grid1->FilterBarPromptPattern = L"Nancy"; Grid1->FilterInclude = Exgridlib_tlb::FilterIncludeEnum::exItemsWithChilds; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Name")->Width = 96; var_Columns->Add(L"Title")->Width = 96; var_Columns->Add(L"City"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h0 = var_Items->AddItem(TVariant("Nancy Davolio")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Seattle")); h0 = var_Items->InsertItem(h0,TNoParam(),TVariant("Andrew Fuller")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Vice President, Sales")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Tacoma")); h0 = var_Items->InsertItem(h0,TNoParam(),TVariant("Michael Suyama")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("London")); h0 = var_Items->AddItem(TVariant("Janet Leverling")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Kirkland")); h0 = var_Items->InsertItem(h0,TNoParam(),TVariant("Margaret Peacock")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Redmond")); var_Items->set_ExpandItem(0,true); Grid1->ApplyFilter(); Grid1->EndUpdate(); |
985 |
How do I prevent changing the cell's state ( check-box state )
|
984 |
How do I get sorted the column as string, numeric, date, date and time. Also how can it be applied to drop down filter panel
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Date"); var_Column->SortType = Exgridlib_tlb::SortTypeEnum::SortDate; var_Column->DisplayFilterButton = true; var_Column->DisplayFilterPattern = false; var_Column->DisplayFilterDate = true; var_Column->FilterList = Exgridlib_tlb::FilterListEnum::exShowFocusItem | Exgridlib_tlb::FilterListEnum::exShowCheckBox | Exgridlib_tlb::FilterListEnum::exSortItemsDesc; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"DateTime"); var_Column1->SortType = Exgridlib_tlb::SortTypeEnum::SortDateTime; var_Column1->DisplayFilterButton = true; var_Column1->DisplayFilterPattern = false; var_Column1->FilterList = Exgridlib_tlb::FilterListEnum::exShowFocusItem | Exgridlib_tlb::FilterListEnum::exShowCheckBox | Exgridlib_tlb::FilterListEnum::exSortItemsDesc; Exgridlib_tlb::IColumnPtr var_Column2 = Grid1->Columns->Add(L"Time"); var_Column2->SortType = Exgridlib_tlb::SortTypeEnum::SortTime; var_Column2->DisplayFilterButton = true; var_Column2->DisplayFilterPattern = false; var_Column2->FilterList = Exgridlib_tlb::FilterListEnum::exShowFocusItem | Exgridlib_tlb::FilterListEnum::exShowCheckBox | Exgridlib_tlb::FilterListEnum::exSortItemsDesc; var_Column2->FormatColumn = L"time(value)"; Exgridlib_tlb::IColumnPtr var_Column3 = Grid1->Columns->Add(L"Numeric"); var_Column3->SortType = Exgridlib_tlb::SortTypeEnum::SortNumeric; var_Column3->DisplayFilterButton = true; var_Column3->FilterList = Exgridlib_tlb::FilterListEnum::exShowFocusItem | Exgridlib_tlb::FilterListEnum::exShowCheckBox | Exgridlib_tlb::FilterListEnum::exSortItemsDesc; Exgridlib_tlb::IColumnPtr var_Column4 = Grid1->Columns->Add(L"String"); var_Column4->DisplayFilterButton = true; var_Column4->FilterList = Exgridlib_tlb::FilterListEnum::exShowFocusItem | Exgridlib_tlb::FilterListEnum::exShowCheckBox | Exgridlib_tlb::FilterListEnum::exSortItemsDesc; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant(TDateTime(2010,1,27).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2010,1,27,10,00,00,0).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(var_Items->get_CellValue(TVariant(h),TVariant(1)))); var_Items->set_CellValue(TVariant(h),TVariant(3),TVariant(1)); var_Items->set_CellValue(TVariant(h),TVariant(4),TVariant(var_Items->get_CellValue(TVariant(h),TVariant(3)))); h = var_Items->AddItem(TVariant(TDateTime(2011,1,27).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2011,1,27,9,00,00,0).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(var_Items->get_CellValue(TVariant(h),TVariant(1)))); var_Items->set_CellValue(TVariant(h),TVariant(3),TVariant(11)); var_Items->set_CellValue(TVariant(h),TVariant(4),TVariant(var_Items->get_CellValue(TVariant(h),TVariant(3)))); h = var_Items->AddItem(TVariant(TDateTime(2010,11,2).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2010,11,2,9,00,00,0).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(var_Items->get_CellValue(TVariant(h),TVariant(1)))); var_Items->set_CellValue(TVariant(h),TVariant(3),TVariant(2)); var_Items->set_CellValue(TVariant(h),TVariant(4),TVariant(var_Items->get_CellValue(TVariant(h),TVariant(3)))); Grid1->Columns->get_Item(TVariant("DateTime"))->DisplayFilterDate = false; Grid1->EndUpdate(); |
983 |
I am using Layout property to sort multiple columns at once. The problem is that all items get expanded. How do I prevent that
Grid1->BeginUpdate(); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"P1"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Column->PartialCheck = true; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"P2"); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Column1->PartialCheck = true; var_Column1->FormatColumn = L"1 index ``"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child A")); var_Items->InsertItem(h,TNoParam(),TVariant("Child B")); var_Items->InsertItem(h,TNoParam(),TVariant("Child A")); var_Items->InsertItem(h,TNoParam(),TVariant("Child B")); var_Items->AddItem(TVariant("Root")); var_Items->AddItem(TVariant("Root")); Grid1->SingleSort = false; Grid1->Layout = L"multiplesort=\"C0:1 C1:2\";collapse=\"\""; Grid1->EndUpdate(); |
982 |
How do I find the cell's type, or what the cell holds
Grid1->BeginUpdate(); Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Value")->Width = 24; var_Columns->Add(L"Type")->FormatColumn = L"type(%0)"; var_Columns->Add(L"TypeAsString")->FormatColumn = TVariant(String("(0 := type(%0)) array (`empty`, `null`, `short`, `long`, `float`, `double`, `currency`, `date`, `string`, `object`, `error`, `b") + "oolean`, `variant`, `any`, `reserved`, `decimal`, `char`, `byte`, `unsigned short`, `unsigned long`, `long on 64 bits`)"); var_Columns->Add(L"Length")->FormatColumn = L"len(%0)"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TNoParam()); var_Items->AddItem(TVariant("")); var_Items->set_CellValue(TVariant(->AddItem(TNoParam())),TVariant(0),Grid1->DefaultDispatch); var_Items->set_CellValue(TVariant(var_Items->AddItem(TNoParam())),TVariant(0),TVariant(true)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TNoParam())),TVariant(0),TVariant(-1)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TNoParam())),TVariant(0),TVariant(-1)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TNoParam())),TVariant(0),TVariant(TDateTime(2001,1,1).operator double())); Grid1->EndUpdate(); |
981 |
How can I get ride / hide the image being dragged by OLE Drag and Drop
// OLEStartDrag event - Occurs when the OLEDrag method is called. void __fastcall TForm1::Grid1OLEStartDrag(TObject *Sender,Exgridlib_tlb::IExDataObject *Data,long * AllowedEffects) { // Data.SetData("data to drag") AllowedEffects = 1; } Grid1->OLEDropMode = Exgridlib_tlb::exOLEDropModeEnum::exOLEDropManual; Grid1->Background[Exgridlib_tlb::BackgroundPartEnum::exDragDropAfter] = RGB(255,255,255); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->Columns->Add(L"Default"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 1")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 2")); var_Items->set_ExpandItem(h,true); |
980 |
The ReadOnly property does not prevent changing the column's check-box (sample 2)
Grid1->BeginUpdate(); Grid1->ShowFocusRect = false; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"C1"); var_Column->AllowSizing = false; var_Column->Width = 18; var_Column->Editor->EditType = Exgridlib_tlb::EditTypeEnum::CheckValueType; Grid1->Columns->Add(L"C2"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(0))),TVariant(1),TVariant("Item 1")); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(-1))),TVariant(1),TVariant("Item 2")); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(0))),TVariant(1),TVariant("Item 3")); Grid1->ReadOnly = Exgridlib_tlb::ReadOnlyEnum::exReadOnly; Grid1->Columns->get_Item(TVariant(0))->Editor->set_Option(Exgridlib_tlb::EditorOptionEnum::exCheckValue2,TVariant(2)); Grid1->EndUpdate(); |
979 |
The ReadOnly property does not prevent changing the column's check-box (sample 1)
Grid1->BeginUpdate(); Grid1->ShowFocusRect = false; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"C1"); var_Column->AllowSizing = false; var_Column->Width = 18; Exgridlib_tlb::IEditorPtr var_Editor = var_Column->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::CheckValueType; var_Editor->set_Option(Exgridlib_tlb::EditorOptionEnum::exCheckValue2,TVariant(1)); Grid1->Columns->Add(L"C2"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(0))),TVariant(1),TVariant("Item 1")); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(-1))),TVariant(1),TVariant("Item 2")); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(0))),TVariant(1),TVariant("Item 3")); Grid1->ReadOnly = Exgridlib_tlb::ReadOnlyEnum::exReadOnly; Grid1->EndUpdate(); |
978 |
How can I export checked items only
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"C1")->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Columns->Add(L"C2")->FormatColumn = L"1 index `A-Z`"; var_Columns->Add(L"C3")->FormatColumn = L"100 index ``"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Item 1")); var_Items->set_CellState(TVariant(var_Items->AddItem(TVariant("Item 2"))),TNoParam(),1); var_Items->set_CellState(TVariant(var_Items->AddItem(TVariant("Item 3"))),TNoParam(),1); Grid1->EndUpdate(); OutputDebugString( L"Export CSV Checked Items Only:" ); OutputDebugString( PChar(Grid1->Export(TVariant(""),TVariant("chk"))) ); |
977 |
How can I export a hidden column
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"C1"); Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"C2"); var_Column->FormatColumn = L"1 index `A-Z`"; var_Column->Visible = false; Exgridlib_tlb::IColumnPtr var_Column1 = var_Columns->Add(L"C3"); var_Column1->FormatColumn = L"100 index ``"; var_Column1->Visible = false; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Item 1")); var_Items->AddItem(TVariant("Item 2")); var_Items->AddItem(TVariant("Item 3")); Grid1->EndUpdate(); OutputDebugString( L"Export CSV Hidden Columns (1,2):" ); OutputDebugString( PChar(Grid1->Export(TVariant(""),TVariant("|1,2"))) ); |
976 |
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 3)
Grid1->BeginUpdate(); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->AutoDrag = Exgridlib_tlb::AutoDragEnum::exAutoDragPositionAny; Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exSolidLine; Grid1->Indent = 16; Grid1->MarkSearchColumn = false; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L""); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column->FormatColumn = L"((1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 + `` : (=:0 mid (1 + 1 + =:1) ) + `)` ) + ` ` + value"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); long hChild = var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->set_ExpandItem(0,true); h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); hChild = var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->set_CellState(TVariant(hChild),TVariant(0),1); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); Grid1->EndUpdate(); |
975 |
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 2)
Grid1->BeginUpdate(); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->GridLineColor = RGB(190,190,190); Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->AutoDrag = Exgridlib_tlb::AutoDragEnum::exAutoDragPositionAny; Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exSolidLine; Grid1->Indent = 16; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Default"); Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L""); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellPaddingRight,TVariant(4)); var_Column->AllowSizing = false; var_Column->Width = 36; var_Column->Position = 0; var_Column->FormatColumn = TVariant(String("(1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 : (`............` left 2 * (=:0 count `.`)) + (=:0 mid (1 + 1 + =") + ":1) ) "); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); long hChild = var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->set_ExpandItem(0,true); h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); hChild = var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->set_CellState(TVariant(hChild),TVariant(0),1); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); Grid1->EndUpdate(); |
974 |
I'm trying to use automatic numbering of the outline. How can I have A, B, C for root items, 1, 2, 3 for the sub-items, and a, b, c for sub-sub-items (sample 1)
Grid1->BeginUpdate(); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->AutoDrag = Exgridlib_tlb::AutoDragEnum::exAutoDragPositionAny; Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exSolidLine; Grid1->Indent = 16; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Default"); Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L""); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellPaddingRight,TVariant(4)); var_Column->Alignment = Exgridlib_tlb::AlignmentEnum::RightAlignment; var_Column->AllowSizing = false; var_Column->Width = 24; var_Column->Position = 0; var_Column->FormatColumn = L"(1:=(0 :=(1 rpos '.|A-Z||a-z|')) rfind `.`) < 0 ? `<b>` + =:0 : `<i>` + (=:0 mid (1 + 1 + =:1) ) "; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); long hChild = var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->set_ExpandItem(0,true); h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); hChild = var_Items->InsertItem(h,TNoParam(),TVariant("Child")); var_Items->set_CellState(TVariant(hChild),TVariant(0),1); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(hChild,TNoParam(),TVariant("Child")); var_Items->InsertItem(h,TNoParam(),TVariant("Child")); Grid1->EndUpdate(); |
973 |
How can I programmatically group by columns, without having the control's sort bar visible
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SortBarHeight = 0; Grid1->SortBarVisible = true; Grid1->SortBarCaption = L"Drag a <b>column</b> header here to group by that column."; Grid1->AllowGroupBy = true; Grid1->Layout = L"multiplesort=\"C1:2\""; Grid1->EndUpdate(); |
972 |
How do I perform my own sort
// Sort event - Fired when the control sorts a column. void __fastcall TForm1::Grid1Sort(TObject *Sender) { OutputDebugString( L"Sort" ); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_ItemPosition(var_Items->get_ItemByIndex(1),0); var_Items->set_ItemPosition(var_Items->get_ItemByIndex(0),1); } Grid1->BeginUpdate(); Grid1->SingleSort = false; Grid1->SortOnClick = Exgridlib_tlb::SortOnClickEnum::exUserSort; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Index")->FormatColumn = L"0 index ``"; var_Columns->Add(L"Data 1"); var_Columns->Add(L"Data 2"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant(0)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(2)); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(3)); h = var_Items->AddItem(TVariant(4)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(5)); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(6)); h = var_Items->AddItem(TVariant(7)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(8)); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(9)); Grid1->Layout = L"multiplesort=\"C1:1 C2:2\""; Grid1->EndUpdate(); |
971 |
Is it possible to have a different alignment for parts of the cell's caption
Grid1->BeginUpdate(); Grid1->TreeColumnIndex = -1; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Default"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellHAlignment(TVariant(var_Items->AddItem(TVariant("all-left"))),TVariant(0),Exgridlib_tlb::AlignmentEnum::LeftAlignment); var_Items->set_CellHAlignment(TVariant(var_Items->AddItem(TVariant("all-center"))),TVariant(0),Exgridlib_tlb::AlignmentEnum::CenterAlignment); var_Items->set_CellHAlignment(TVariant(var_Items->AddItem(TVariant("all-right"))),TVariant(0),Exgridlib_tlb::AlignmentEnum::RightAlignment); long h = var_Items->AddItem(TVariant("left<c>center<r>right")); var_Items->set_CellValueFormat(TVariant(h),TVariant(0),Exgridlib_tlb::ValueFormatEnum::exHTML); Grid1->EndUpdate(); |
970 |
I have a column with Def(exCellSingleLine) property on False, word-wrapping, and I am wondering if possible to update the column's content while user is resizing it
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"MultipleLine"); var_Column->Width = 32; var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(false)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exColumnResizeContiguously,TVariant(true)); Exgridlib_tlb::IColumnPtr var_Column1 = var_Columns->Add(L"SingleLine"); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(false)); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("This is a bit of long text that should break the line"))),TVariant(1),TVariant("This is a bit of long text that should break the line")); Grid1->EndUpdate(); |
969 |
How can I get the absolute position of an item
// MouseMove event - Occurs when the user moves the mouse. void __fastcall TForm1::Grid1MouseMove(TObject *Sender,short Button,short Shift,int X,int Y) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; OutputDebugString( var_Items->get_CellCaption(TVariant(Grid1->get_ItemFromPoint(-1,-1,c,hit)),TVariant("Position")) ); } Grid1->BeginUpdate(); Grid1->BackColorAlternate = RGB(240,240,240); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->Columns->Add(L"Def")->DisplayFilterButton = true; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(var_Items->InsertItem(h,TNoParam(),TVariant("Child 1")),TNoParam(),TVariant("Sub-Child 1")); var_Items->InsertItem(var_Items->InsertItem(h,TNoParam(),TVariant("Child 2")),TNoParam(),TVariant("Sub-Child 2")); Grid1->PutItems(Grid1->GetItems(TVariant(-1)),TNoParam()); Grid1->PutItems(Grid1->GetItems(TVariant(-1)),TNoParam()); Grid1->PutItems(Grid1->GetItems(TVariant(-1)),TNoParam()); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Position"); var_Column->FormatColumn = L"1 apos ``"; var_Column->Visible = false; Grid1->EndUpdate(); |
968 |
I am using ExComboBox as an user editor, how can I display a different column
// UserEditorClose event - Fired the user editor is about to be opened. void __fastcall TForm1::Grid1UserEditorClose(TObject *Sender,IDispatch *Object,Exgridlib_tlb::HITEM Item,long ColIndex) { // Items.CellValue(Item,ColIndex) = Object.Value } // UserEditorOleEvent event - Occurs when an user editor fires an event. void __fastcall TForm1::Grid1UserEditorOleEvent(TObject *Sender,IDispatch *Object,Exgridlib_tlb::IOleEvent *Ev,VARIANT_BOOL * CloseEditor,Exgridlib_tlb::HITEM Item,long ColIndex) { OutputDebugString( L"Ev" ); } // UserEditorOpen event - Occurs when an user editor is about to be opened. void __fastcall TForm1::Grid1UserEditorOpen(TObject *Sender,IDispatch *Object,Exgridlib_tlb::HITEM Item,long ColIndex) { // Object.Value = Me.Items.CellValue(Item,ColIndex) } Grid1->BeginUpdate(); Exgridlib_tlb::IEditorPtr var_Editor = Grid1->Columns->Add(L"Exontrol.ComboBox")->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::UserEditorType; var_Editor->UserEditor(L"Exontrol.ComboBox",L""); _tlb::ObjectPtr var_Object = var_Editor->UserEditorObject; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->DefaultItemHeight = 21; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellEditorVisible(TVariant(var_Items->AddItem(TVariant(10248))),TVariant(0),Exgridlib_tlb::EditorVisibleEnum::exEditorVisible); var_Items->set_CellEditorVisible(TVariant(var_Items->AddItem(TVariant(10249))),TVariant(0),Exgridlib_tlb::EditorVisibleEnum::exEditorVisible); var_Items->set_CellEditorVisible(TVariant(var_Items->AddItem(TVariant(10250))),TVariant(0),Exgridlib_tlb::EditorVisibleEnum::exEditorVisible); Grid1->EndUpdate(); |
967 |
How do I sort the index column as numeric (Method 3)
// AddItem event - Occurs after a new Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellData(TVariant(Item),TVariant(1),TVariant(var_Items->get_CellCaption(TVariant(Item),TVariant(1)))); } Grid1->BeginUpdate(); Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exAllLines; Grid1->ColumnAutoResize = true; Grid1->ShowFocusRect = false; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Next"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellPaddingLeft,TVariant(4)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exHeaderPaddingLeft,TVariant(4)); Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Index"); var_Column1->AllowSizing = false; var_Column1->Width = 48; var_Column1->FormatColumn = L"(((0 := (1 index ``)) mod 3) case ( default: ``; 0 : `<r><fgcolor=B0B0B0>`; 1: ``; 2 : `<c><fgcolor=808080>` )) + str(=:0)"; var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column1->SortType = Exgridlib_tlb::SortTypeEnum::SortUserData; var_Column1->Position = 0; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Item 1")); var_Items->AddItem(TVariant("Item 2")); var_Items->AddItem(TVariant("Item 3")); var_Items->AddItem(TVariant("Item 4")); var_Items->AddItem(TVariant("Item 5")); var_Items->AddItem(TVariant("Item 6")); var_Items->AddItem(TVariant("Item 7")); var_Items->AddItem(TVariant("Item 8")); var_Items->AddItem(TVariant("Item 9")); var_Items->AddItem(TVariant("Item 10")); Grid1->EndUpdate(); |
966 |
How do I sort the index column as numeric (Method 2)
// AddItem event - Occurs after a new Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellSortData(TVariant(Item),TVariant(1),TVariant(var_Items->get_CellCaption(TVariant(Item),TVariant(1)))); } Grid1->BeginUpdate(); Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exAllLines; Grid1->ColumnAutoResize = true; Grid1->ShowFocusRect = false; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Next"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellPaddingLeft,TVariant(4)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exHeaderPaddingLeft,TVariant(4)); Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Index"); var_Column1->AllowSizing = false; var_Column1->Width = 48; var_Column1->FormatColumn = L"(((0 := (1 index ``)) mod 3) case ( default: ``; 0 : `<r><fgcolor=B0B0B0>`; 1: ``; 2 : `<c><fgcolor=808080>` )) + str(=:0)"; var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column1->SortType = Exgridlib_tlb::SortTypeEnum::SortCellData; var_Column1->Position = 0; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Item 1")); var_Items->AddItem(TVariant("Item 2")); var_Items->AddItem(TVariant("Item 3")); var_Items->AddItem(TVariant("Item 4")); var_Items->AddItem(TVariant("Item 5")); var_Items->AddItem(TVariant("Item 6")); var_Items->AddItem(TVariant("Item 7")); var_Items->AddItem(TVariant("Item 8")); var_Items->AddItem(TVariant("Item 9")); var_Items->AddItem(TVariant("Item 10")); Grid1->EndUpdate(); |
965 |
How do I sort the index column as numeric (Method 1)
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Sort Index As String (Default)"); var_Column->FormatColumn = L"1 index ``"; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Sort Index As Numeric"); var_Column1->ComputedField = L"%C0"; var_Column1->SortType = Exgridlib_tlb::SortTypeEnum::SortNumeric; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); Grid1->EndUpdate(); |
964 |
How can I put icons/images into buttons
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = true; Grid1->Images(TVariant(String("gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTq") + "lVq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m" + "0ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/y" + "NAOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA=")); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"C+B"); var_Column->AllowSizing = false; var_Column->Width = 48; var_Column->FormatColumn = L"` <img>` + ( 1 + (1 index ``) mod 3 ) + `</img> `"; var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasButton,TVariant(true)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellButtonAutoWidth,TVariant(true)); Grid1->Columns->Add(L""); Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exVLines; Grid1->DefaultItemHeight = 20; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); Grid1->EndUpdate(); |
963 |
Is it possible to have a CheckBox and Button TOGETHER on all cells in a column
// ButtonClick event - Occurs when user clicks on the cell's button. void __fastcall TForm1::Grid1ButtonClick(TObject *Sender,Exgridlib_tlb::HITEM Item,long ColIndex,Variant Key) { OutputDebugString( L"ButtonClick" ); OutputDebugString( L"Item" ); OutputDebugString( L"Key" ); } // CellStateChanged event - Fired after cell's state has been changed. void __fastcall TForm1::Grid1CellStateChanged(TObject *Sender,Exgridlib_tlb::HITEM Item,long ColIndex) { OutputDebugString( L"CellStateChanged" ); OutputDebugString( L"Item" ); } Grid1->BeginUpdate(); Grid1->ColumnAutoResize = true; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L""); var_Column->AllowSizing = false; var_Column->Width = 32; var_Column->FormatColumn = L"1 index ``"; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Def"); var_Column1->AllowSizing = false; var_Column1->Width = 48; var_Column1->FormatColumn = L"` `"; var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasButton,TVariant(true)); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellButtonAutoWidth,TVariant(true)); Grid1->Columns->Add(L""); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); Grid1->EndUpdate(); |
962 |
I have columns that look up the same data. (e.g. different contact) so both could / should use the same editor. Is this possible, to use other column's editor
Grid1->BeginUpdate(); Grid1->SelBackColor = Grid1->BackColor; Grid1->SelForeColor = Grid1->ForeColor; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"Pos"); var_Column->Width = 32; var_Column->AllowSizing = false; var_Column->FormatColumn = L"1 index ``"; Exgridlib_tlb::IEditorPtr var_Editor = var_Columns->Add(L"C1")->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::ColorListType; var_Editor->ClearItems(); var_Editor->AddItem(255,L"Red Color",TNoParam()); var_Editor->AddItem(16711680,L"Blue Color",TNoParam()); var_Editor->AddItem(65280,L"Green Color",TNoParam()); var_Columns->Add(L"C2")->Editor->EditType = Exgridlib_tlb::EditTypeEnum::CloneType | Exgridlib_tlb::EditTypeEnum::EditType; var_Columns->Add(L"C3")->Editor->EditType = Exgridlib_tlb::EditTypeEnum::CloneType | Exgridlib_tlb::EditTypeEnum::EditType; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(16711680)); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(65280)); var_Items->set_CellValue(TVariant(h),TVariant(3),TVariant(255)); h = var_Items->AddItem(TVariant("")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(255)); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(16711680)); var_Items->set_CellValue(TVariant(h),TVariant(3),TVariant(65280)); Grid1->EndUpdate(); |
961 |
Is there an easy way to get an effect like in a Microsoft Access / SQL-Server Table view, where you can scroll-up till the last row containing data is displayed as top-row
Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->ScrollBars = Exgridlib_tlb::ScrollBarsEnum::exVScrollEmptySpace | Exgridlib_tlb::ScrollBarsEnum::exBoth; Grid1->ScrollPos[true] = Grid1->Items->ItemCount; Grid1->EndUpdate(); |
960 |
Does filtering work with umlauts / accents characters
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Names"); var_Column->DisplayFilterButton = true; var_Column->FilterType = Exgridlib_tlb::FilterTypeEnum::exPattern; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Mantel")); var_Items->AddItem(TVariant("Mechanik")); var_Items->AddItem(TVariant("Motor")); var_Items->AddItem(TVariant("Murks")); var_Items->AddItem(TVariant("Märchen")); var_Items->AddItem(TVariant("Möhren")); var_Items->AddItem(TVariant("Mühle")); var_Items->AddItem(TVariant("Sérigraphie")); Grid1->Columns->get_Item(TVariant(0))->Filter = L"*ä*"; Grid1->ApplyFilter(); Grid1->EndUpdate(); |
959 |
How FullPath method works
Grid1->BeginUpdate(); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->Columns->Add(L"C1"); Grid1->Columns->Add(L"C2"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant("A")); var_Items->set_CellValue(TVariant(var_Items->InsertItem(h,TNoParam(),TVariant("Child 1"))),TVariant(1),TVariant("B")); var_Items->set_CellValue(TVariant(var_Items->InsertItem(h,TNoParam(),TVariant("Child 2"))),TVariant(1),TVariant("C")); var_Items->set_ExpandItem(h,true); Grid1->SearchColumnIndex = 1; OutputDebugString( PChar(Grid1->SearchColumnIndex) ); OutputDebugString( ->get_FullPath(Grid1->Items->get_ItemByIndex(2)) ); Grid1->SearchColumnIndex = 0; OutputDebugString( PChar(Grid1->SearchColumnIndex) ); OutputDebugString( ->get_FullPath(Grid1->Items->get_ItemByIndex(2)) ); Grid1->EndUpdate(); |
958 |
Can I set the search box / filterbarprompt to invisible, so I can use my own input and *string* via VBA
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = true; Grid1->ContinueColumnScroll = false; Grid1->MarkSearchColumn = false; Grid1->SearchColumnIndex = 1; Grid1->FilterBarHeight = 0; Grid1->FilterBarPromptVisible = Exgridlib_tlb::FilterBarVisibleEnum::exFilterBarPromptVisible; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Name")->Width = 96; var_Columns->Add(L"Title")->Width = 96; var_Columns->Add(L"City"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h0 = var_Items->AddItem(TVariant("Nancy Davolio")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Seattle")); h0 = var_Items->AddItem(TVariant("Andrew Fuller")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Vice President, Sales")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Tacoma")); var_Items->set_SelectItem(h0,true); h0 = var_Items->AddItem(TVariant("Janet Leverling")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Kirkland")); h0 = var_Items->AddItem(TVariant("Margaret Peacock")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Redmond")); h0 = var_Items->AddItem(TVariant("Steven Buchanan")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Manager")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("London")); h0 = var_Items->AddItem(TVariant("Michael Suyama")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("London")); h0 = var_Items->AddItem(TVariant("Robert King")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("London")); h0 = var_Items->AddItem(TVariant("Laura Callahan")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Inside Sales Coordinator")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("Seattle")); h0 = var_Items->AddItem(TVariant("Anne Dodsworth")); var_Items->set_CellValue(TVariant(h0),TVariant(1),TVariant("Sales Representative")); var_Items->set_CellValue(TVariant(h0),TVariant(2),TVariant("London")); Grid1->FilterBarPromptPattern = L"London"; Grid1->EndUpdate(); |
957 |
How to load a hierarchy using the control's DataSource property (Parent-ID-Relation)
// AddItem event - Occurs after a new Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->SetParent(Item,var_Items->get_FindItem(TVariant(var_Items->get_CellValue(TVariant(Item),TVariant("ReportsTo"))),TVariant("EmployeeID"),TNoParam())); } Grid1->BeginUpdate(); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->ColumnAutoResize = false; Grid1->ContinueColumnScroll = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("SELECT * FROM Employees ORDER BY ReportsTo"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->Items->set_ExpandItem(0,true); Grid1->EndUpdate(); |
956 |
Is it possible to select the entire row/line, when user clicks the first column, and select individually the rest of cells, while user clicks any other column
// MouseDown event - Occurs when the user presses a mouse button. void __fastcall TForm1::Grid1MouseDown(TObject *Sender,short Button,short Shift,int X,int Y) { long i = Grid1->ItemFromPoint[-1,-1,c,hit]; Grid1->FullRowSelect = Grid1->Columns->get_Item(TVariant(c))->get_Data(); } Grid1->BeginUpdate(); Grid1->HeaderHeight = 22; Grid1->HeaderAppearance = Exgridlib_tlb::AppearanceEnum::Flat; Grid1->BackColorLock = RGB(240,240,240); Grid1->BackColorHeader = Grid1->BackColorLock; Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; Grid1->SortBarVisible = false; Grid1->AllowGroupBy = true; Grid1->ReadOnly = Exgridlib_tlb::ReadOnlyEnum::exReadOnly; Grid1->ShowFocusRect = false; Grid1->CountLockedColumns = 1; Grid1->AutoDrag = Exgridlib_tlb::AutoDragEnum::exAutoDragScroll; Grid1->SingleSort = false; Grid1->ColumnsAllowSizing = true; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exAllLines; Grid1->GridLineStyle = Exgridlib_tlb::GridLinesStyleEnum::exGridLinesSolid; Grid1->GridLineColor = RGB(220,220,220); /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->Columns->get_Item(TVariant(0))->set_Data(TVariant(-1)); Grid1->Layout = L"singlesort=\"C5:1\";multiplesort=\" C1:2\""; Grid1->EndUpdate(); |
955 |
The user are not able to size the columns at runtime when using HeaderAppearance property on zero
Grid1->VisualAppearance->Add(1,TVariant(String("gBFLBCJwBAEHhEJAAEhABJEIQAAYAQGKIYBkAKBQAGaAoDDcMQ5QwAAyDGKEEwsACEIrjKCRShyCYZRhGcTSBCIZBqEqSZLiEZRQiiCYsS5GQBSFDcOwHGyQZonKK3L") + "hGCYBgIA=")); Grid1->HeaderAppearance = Exgridlib_tlb::AppearanceEnum(0x1000000); Grid1->Columns->Add(L"1"); Grid1->Columns->Add(L"2"); Grid1->Columns->Add(L"3"); |
954 |
Is it possible to embed the exGauge into the exGrid control
// ItemOleEvent event - Fired when an ActiveX control hosted by an item has fired an event. void __fastcall TForm1::Grid1ItemOleEvent(TObject *Sender,Exgridlib_tlb::HITEM Item,Exgridlib_tlb::IOleEvent *Ev) { /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: ExGauge 1.0 Control Library TypeLib: ExGauge.dll to define the namespace: Exgaugelib_tlb */ //#include "EXGAUGELIB_TLB.h" Exgaugelib_tlb::IGaugePtr var_Gauge = Grid1->Items->get_ItemObject(Grid1->Items->get_ItemByIndex(2)); TVariant v = TVariant(var_Gauge->FormatABC(L"date(`now`)",TNoParam(),TNoParam(),TNoParam())); var_Gauge->Layers->get_Item(TVariant("sec"))->set_Value(TVariant(v)); var_Gauge->Layers->get_Item(TVariant("min"))->set_Value(TVariant(v)); var_Gauge->Layers->get_Item(TVariant("hour"))->set_Value(TVariant(v)); } // MouseMove event - Occurs when the user moves the mouse. void __fastcall TForm1::Grid1MouseMove(TObject *Sender,short Button,short Shift,int X,int Y) { Exgaugelib_tlb::IGaugePtr var_Gauge = Grid1->Items->get_ItemObject(Grid1->Items->get_ItemByIndex(2)); var_Gauge->TimerInterval = 1000; } Grid1->BeginUpdate(); Grid1->ScrollBySingleLine = true; Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exThinLine; Grid1->ScrollBySingleLine = true; Grid1->Columns->Add(L"Default"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Normal Item")); h = var_Items->AddItem(TVariant("Gauge-Clock Inside")); var_Items->set_ExpandItem(h,true); h = var_Items->InsertControlItem(h,L"Exontrol.Gauge",TNoParam()); var_Items->set_ItemHeight(h,256); Exgaugelib_tlb::IGaugePtr var_Gauge = var_Items->get_ItemObject(h); var_Gauge->PicturesPath = L"C:\\Program Files\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Clock"; var_Gauge->set_DefaultLayer(Exgaugelib_tlb::DefaultLayerPropertyEnum::exDefLayerRotateType,TVariant(2)); var_Gauge->Layers->Count = 4; Exgaugelib_tlb::ILayerPtr var_Layer = var_Gauge->Layers->get_Item(TVariant(0)); var_Layer->Background->Picture->set_Name(TVariant("vista_clock.png")); Exgaugelib_tlb::ILayerPtr var_Layer1 = var_Gauge->Layers->get_Item(TVariant(1)); var_Layer1->Position = 3; var_Layer1->set_Key(TVariant("sec")); var_Layer1->OnDrag = Exgaugelib_tlb::OnDragLayerEnum::exDoRotate; var_Layer1->Selectable = false; var_Layer1->Background->Picture->set_Name(TVariant("second-hand.png")); var_Layer1->ValueToRotateAngle = TVariant(String("((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - ") + "floor(=:1)) * 60 )) - floor(=:2) ) * 360"); var_Layer1->RotateAngleToValue = L"value / 360 / 24 / 60"; Exgaugelib_tlb::ILayerPtr var_Layer2 = var_Gauge->Layers->get_Item(TVariant(2)); var_Layer2->Position = 2; var_Layer2->set_Key(TVariant("min")); var_Layer2->OnDrag = Exgaugelib_tlb::OnDragLayerEnum::exDoRotate; var_Layer2->Selectable = false; var_Layer2->Background->Picture->set_Name(TVariant("Minute.png")); var_Layer2->ValueToRotateAngle = TVariant(String("((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(") + "=:1)) * 360"); var_Layer2->RotateAngleToValue = L"value / 360 / 24 / 60"; Exgaugelib_tlb::ILayerPtr var_Layer3 = var_Gauge->Layers->get_Item(TVariant(3)); var_Layer3->Position = 1; var_Layer3->set_Key(TVariant("hour")); var_Layer3->OnDrag = Exgaugelib_tlb::OnDragLayerEnum::exDoRotate; var_Layer3->Background->Picture->set_Name(TVariant("Hour.png")); var_Layer3->ValueToRotateAngle = L"2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )"; var_Layer3->RotateAngleToValue = L"value / 360 * 0.5"; TVariant v = TVariant(var_Gauge->FormatABC(L"date(`now`)",TNoParam(),TNoParam(),TNoParam())); var_Gauge->Layers->get_Item(TVariant("sec"))->set_Value(TVariant(v)); var_Gauge->Layers->get_Item(TVariant("min"))->set_Value(TVariant(v)); var_Gauge->Layers->get_Item(TVariant("hour"))->set_Value(TVariant(v)); h = var_Items->AddItem(TVariant("Normal Item")); Grid1->EndUpdate(); |
953 |
What's the difference between merge cells and divider item
// AddItem event - Occurs after a new Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellBackColor(TVariant(Item),TVariant(0),RGB(240,240,240)); var_Items->set_ItemHasChildren(Item,true); } Grid1->BeginUpdate(); Grid1->TreeColumnIndex = 0; Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exAllLines; Grid1->Columns->Add(L"C1")->FormatColumn = L"1 index `A-Z`"; Grid1->Columns->Add(L"C2")->FormatColumn = L"1 index ``"; Grid1->Columns->Add(L"C3")->FormatColumn = L"1 index ``"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TNoParam()); var_Items->AddItem(TNoParam()); long h = var_Items->AddItem(TNoParam()); var_Items->set_CellMerge(TVariant(h),TVariant(0),TVariant(1)); var_Items->set_FormatCell(TVariant(h),TVariant(0),L"`merge cells`"); var_Items->set_CellHAlignment(TVariant(h),TVariant(0),Exgridlib_tlb::AlignmentEnum::CenterAlignment); h = var_Items->AddItem(TNoParam()); var_Items->set_ItemDivider(h,0); var_Items->set_CellHAlignment(TVariant(h),TVariant(0),Exgridlib_tlb::AlignmentEnum::CenterAlignment); var_Items->set_FormatCell(TVariant(h),TVariant(0),L"`item divider`"); var_Items->AddItem(TNoParam()); var_Items->AddItem(TNoParam()); Grid1->EndUpdate(); |
952 |
is it possible to resize a column with the mouse without changing the width of the next column
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; Grid1->Columns->Add(L"Column 1")->Width = 256; Grid1->Columns->Add(L"Column 2")->Width = 512; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exAllLines; Grid1->EndUpdate(); |
951 |
How do I ensure that the newly item fits the control's client area
// ButtonClick event - Occurs when user clicks on the cell's button. void __fastcall TForm1::Grid1ButtonClick(TObject *Sender,Exgridlib_tlb::HITEM Item,long ColIndex,Variant Key) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("")); var_Items->set_SelectItem(h,true); var_Items->EnsureVisibleItem(h); Grid1->FocusColumnIndex = 0; } Grid1->BeginUpdate(); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L""); var_Column->AllowSizing = false; var_Column->AllowDragging = false; var_Column->AllowSort = false; var_Column->Width = 24; var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasButton,TVariant(true)); Grid1->Columns->Add(L"Position")->FormatColumn = L"1 apos `A-Z`"; Grid1->CountLockedColumns = 1; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); Grid1->EndUpdate(); |
950 |
How do I find the predefined string for giving value, or giving identifier for specified predefined caption of editor
// Change event - Occurs when the user changes the cell's content. void __fastcall TForm1::Grid1Change(TObject *Sender,Exgridlib_tlb::HITEM Item,long ColIndex,Variant * NewValue) { OutputDebugString( L"FindItem(numeric) is " ); OutputDebugString( L"NewValue" ); OutputDebugString( PChar(Grid1->Columns->get_Item(TVariant(0))->Editor->get_FindItem(TVariant(NewValue))) ); } Grid1->BeginUpdate(); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"DropDownList"); Exgridlib_tlb::IEditorPtr var_Editor = var_Column->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::DropDownListType; var_Editor->AddItem(1,L"Ken Robinson",TNoParam()); var_Editor->AddItem(2,L"Dave Nichols",TNoParam()); var_Editor->AddItem(3,L"Zane Thomas",TNoParam()); var_Editor->AddItem(4,L"James Shields",TNoParam()); Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"CellValue"); var_Column1->FormatColumn = L"%0"; var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellBackColor,TVariant(15790320)); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exHeaderBackColor,TVariant(var_Column1->get_Def(Exgridlib_tlb::DefColumnEnum::exCellBackColor))); Exgridlib_tlb::IColumnPtr var_Column2 = Grid1->Columns->Add(L"CellCaption"); var_Column2->FormatColumn = L"%C0"; var_Column2->set_Def(Exgridlib_tlb::DefColumnEnum::exCellBackColor,TVariant(15790320)); var_Column2->set_Def(Exgridlib_tlb::DefColumnEnum::exHeaderBackColor,TVariant(var_Column2->get_Def(Exgridlib_tlb::DefColumnEnum::exCellBackColor))); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant(1)); var_Items->AddItem(TVariant(Grid1->Columns->get_Item(TVariant(0))->Editor->get_FindItem(TVariant("Zane Thomas")))); var_Items->AddItem(TVariant(2)); Grid1->EndUpdate(); |
949 |
How can I align captions of items with checkbox, with items with no checkbox
Grid1->BeginUpdate(); Grid1->Columns->Add(L"Default"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellImages(TVariant(var_Items->AddItem(TVariant(0))),TVariant(0),TVariant("1")); var_Items->set_CellHasCheckBox(TVariant(var_Items->AddItem(TVariant(1))),TVariant(0),true); var_Items->set_CellImages(TVariant(var_Items->AddItem(TVariant(2))),TVariant(0),TVariant("1")); Grid1->EndUpdate(); |
948 |
How can I prevent sorting a column
Grid1->BeginUpdate(); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Default"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Column->PartialCheck = true; var_Column->AllowSort = false; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 1")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 2")); var_Items->set_ExpandItem(h,true); Grid1->EndUpdate(); |
947 |
Is there a possibility to group without moving and showing the column to the SortBar
Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SingleSort = false; Grid1->SortBarVisible = false; Grid1->AllowGroupBy = true; Grid1->Layout = L"singlesort=\"C5:1\";multiplesort=\" C1:2\""; Grid1->EndUpdate(); |
946 |
How can I show each group header ( not-subroup ), with a different background color, while alternate background colors for inside items
// LayoutChanged event - Occurs when column's position or column's size is changed. void __fastcall TForm1::Grid1LayoutChanged(TObject *Sender) { Grid1->Refresh(); } Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SingleSort = false; Grid1->SortBarVisible = true; Grid1->AllowGroupBy = true; Grid1->Columns->get_Item(TVariant(1))->SortOrder = true; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Position"); var_Column->FormatColumn = L"(0:= (1 rpos '')) right ( ( 1:= ( =:0 rfind `.` ) ) != -1 ? =:1 : len(=:0))"; var_Column->Visible = false; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Position"); var_Column1->FormatColumn = L"(1 rpos '') contains '.'"; var_Column1->Visible = false; Grid1->ConditionalFormats->Add(L"(%C13 mod 2) != 0",TNoParam())->BackColor = RGB(240,240,240); Grid1->ConditionalFormats->Add(L"%C14 = 0",TNoParam())->BackColor = RGB(190,190,190); Grid1->EndUpdate(); |
945 |
What is the difference between %0 and %C0, when using in expressions ( format, conditional format, computed fields, and so on )
Grid1->BeginUpdate(); Grid1->HeaderAppearance = Exgridlib_tlb::AppearanceEnum::Etched; Grid1->HeaderHeight = 24; Grid1->ScrollBySingleLine = true; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->Columns->Add(L"Value")->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"FormatColumn = `%0` ~ CellValue"); var_Column->FormatColumn = L"%0"; var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(false)); Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"FormatColumn = `%C0`~ CellCaption"); var_Column1->FormatColumn = L"%C0"; var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(false)); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant(1.1234)); var_Items->set_CellValueFormat(TVariant(var_Items->AddItem(TVariant("<sha ;;0>This <fgcolor=FF0000>is a <s><b>HTM</fgcolor>L</b> text</s>."))),TVariant(0),Exgridlib_tlb::ValueFormatEnum::exHTML); Exgridlib_tlb::IEditorPtr var_Editor = var_Items->get_CellEditor(TVariant(var_Items->AddItem(TVariant(3))),TNoParam()); var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::CheckListType; var_Editor->AddItem(1,L"Border",TNoParam()); var_Editor->AddItem(2,L"Thick",TNoParam()); var_Editor->AddItem(4,L"Shadow",TNoParam()); var_Items->set_FormatCell(TVariant(var_Items->AddItem(TVariant(10000))),TVariant(0),L"`<b>` + currency(value)"); Grid1->EndUpdate(); |
944 |
How can I alternate colors for each group header ( not-subroup ), with a different background color, while items of the same group showing with a different color
// LayoutChanged event - Occurs when column's position or column's size is changed. void __fastcall TForm1::Grid1LayoutChanged(TObject *Sender) { Grid1->Refresh(); } Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SingleSort = false; Grid1->SortBarVisible = true; Grid1->AllowGroupBy = true; Grid1->Columns->get_Item(TVariant(1))->SortOrder = true; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Position"); var_Column->FormatColumn = L"(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"; var_Column->Visible = false; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Position"); var_Column1->FormatColumn = L"(1 rpos '') contains '.'"; var_Column1->Visible = false; Grid1->ConditionalFormats->Add(L"(%C13 mod 2) != 0",TNoParam())->BackColor = RGB(240,240,240); Grid1->ConditionalFormats->Add(L"%C14 = 0",TNoParam())->BackColor = RGB(190,190,190); Grid1->EndUpdate(); |
943 |
How can I highlight each group header, with a different background color (method 2)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddGroupItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { Grid1->Items->set_ItemBackColor(Item,RGB(190,190,190)); } Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SingleSort = false; Grid1->SortBarVisible = true; Grid1->AllowGroupBy = true; Grid1->Columns->get_Item(TVariant(1))->SortOrder = true; Grid1->EndUpdate(); |
942 |
How can I highlight each group header ( not-subroup ), with a different background color (method 1)
// LayoutChanged event - Occurs when column's position or column's size is changed. void __fastcall TForm1::Grid1LayoutChanged(TObject *Sender) { Grid1->Refresh(); } Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SingleSort = false; Grid1->SortBarVisible = true; Grid1->AllowGroupBy = true; Grid1->Columns->get_Item(TVariant(1))->SortOrder = true; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Position"); var_Column->FormatColumn = L"(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"; var_Column->Visible = false; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Position"); var_Column1->FormatColumn = L"(1 rpos '') contains '.'"; var_Column1->Visible = false; Grid1->ConditionalFormats->Add(L"%C14 = 0",TNoParam())->BackColor = RGB(190,190,190); Grid1->EndUpdate(); |
941 |
The BackColorAlternate displays each second row with a different background color. Is it possible to apply a different background color, for each sub-tree, ConditionalFormats, Add
// LayoutChanged event - Occurs when column's position or column's size is changed. void __fastcall TForm1::Grid1LayoutChanged(TObject *Sender) { Grid1->Refresh(); } // Sort event - Fired when the control sorts a column. void __fastcall TForm1::Grid1Sort(TObject *Sender) { Grid1->Refresh(); } Grid1->BeginUpdate(); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"P1"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Column->PartialCheck = true; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"P2"); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Column1->PartialCheck = true; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root 1")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 1")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 2")); var_Items->set_ExpandItem(h,true); h = var_Items->AddItem(TVariant("Root 2")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 1")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 2")); var_Items->set_ExpandItem(h,true); h = var_Items->AddItem(TVariant("Root 2")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 1")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 2")); var_Items->set_ExpandItem(h,true); Exgridlib_tlb::IColumnPtr var_Column2 = Grid1->Columns->Add(L"Position"); var_Column2->FormatColumn = L"(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"; var_Column2->Visible = false; Grid1->ConditionalFormats->Add(L"(%C2 mod 2) != 0",TNoParam())->BackColor = RGB(240,240,240); Grid1->EndUpdate(); |
940 |
The BackColorAlternate displays each second row with a different background color. Is it possible to apply a different background color, for 2nd, 3rd, 4th, row, and so on
// LayoutChanged event - Occurs when column's position or column's size is changed. void __fastcall TForm1::Grid1LayoutChanged(TObject *Sender) { Grid1->Refresh(); } // Sort event - Fired when the control sorts a column. void __fastcall TForm1::Grid1Sort(TObject *Sender) { Grid1->Refresh(); } Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Position"); var_Column->FormatColumn = L"1 apos ''"; var_Column->Visible = false; Grid1->ConditionalFormats->Add(L"(%C13 mod 5) = 1",TNoParam())->BackColor = RGB(128,128,128); Grid1->ConditionalFormats->Add(L"(%C13 mod 5) = 2",TNoParam())->BackColor = RGB(164,164,164); Grid1->ConditionalFormats->Add(L"(%C13 mod 5) = 3",TNoParam())->BackColor = RGB(190,190,190); Grid1->ConditionalFormats->Add(L"(%C13 mod 5) = 4",TNoParam())->BackColor = RGB(240,240,240); Grid1->EndUpdate(); |
939 |
The BackColorAlternate displays each second row with a different background color. The question I have it is possible to apply a different background color for 3rd, 4th, row, and so on
// LayoutChanged event - Occurs when column's position or column's size is changed. void __fastcall TForm1::Grid1LayoutChanged(TObject *Sender) { Grid1->Refresh(); } // Sort event - Fired when the control sorts a column. void __fastcall TForm1::Grid1Sort(TObject *Sender) { Grid1->Refresh(); } Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Position"); var_Column->FormatColumn = L"1 apos ''"; var_Column->Visible = false; Grid1->ConditionalFormats->Add(L"(%C13 mod 4) = 0",TNoParam())->BackColor = RGB(240,240,240); Grid1->EndUpdate(); |
938 |
The BackColorAlternate looks fine for flat tables, but how about using it when displaying a hierarchy/tree, like grouping rows. The sample alternate colors for each group found
// LayoutChanged event - Occurs when column's position or column's size is changed. void __fastcall TForm1::Grid1LayoutChanged(TObject *Sender) { Grid1->Refresh(); } Grid1->BeginUpdate(); Grid1->HasLines = Exgridlib_tlb::HierarchyLineEnum::exNoLine; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SingleSort = false; Grid1->SortBarVisible = true; Grid1->AllowGroupBy = true; Grid1->Columns->get_Item(TVariant(1))->SortOrder = true; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Position"); var_Column->FormatColumn = L"(0:= (1 rpos '')) left ( ( 1:= ( =:0 lfind `.` ) ) != -1 ? =:1 : len(=:0))"; var_Column->Visible = false; Grid1->ConditionalFormats->Add(L"(%C13 mod 2) != 0",TNoParam())->BackColor = RGB(240,240,240); Grid1->EndUpdate(); |
937 |
I need to display sub-totals in the grouping items. Is there any solution on this
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddGroupItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_ItemDivider(Item,-1); var_Items->set_EnableItem(Item,false); var_Items->set_CellValueFormat(TVariant(Item),TVariant(Grid1->TreeColumnIndex),Exgridlib_tlb::ValueFormatEnum::exHTML); var_Items->set_FormatCell(TVariant(Item),TVariant(Grid1->TreeColumnIndex),L"%1"); var_Items->set_CellValueFormat(TVariant(Item),TVariant("Freight"),Exgridlib_tlb::ValueFormatEnum::exTotalField | Exgridlib_tlb::ValueFormatEnum::exHTML); var_Items->set_CellValue(TVariant(Item),TVariant("Freight"),TVariant("sum(current,dir,%6)")); var_Items->set_FormatCell(TVariant(Item),TVariant("Freight"),L"`<b>` + currency(value)"); } Grid1->BeginUpdate(); Grid1->SelBackMode = Exgridlib_tlb::BackModeEnum::exTransparent; Grid1->BackColorSortBar = RGB(240,240,240); Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SortBarVisible = true; Grid1->SortBarCaption = L"Drag a <b>column</b> header here to group by that column."; Grid1->AllowGroupBy = true; Grid1->Columns->get_Item(TVariant(1))->SortOrder = Exgridlib_tlb::SortOrderEnum::SortAscending; Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exGroupLinesOutside; Grid1->Columns->get_Item(TVariant("ShipVia"))->DisplayFilterButton = true; Grid1->EndUpdate(); |
936 |
I use a subtotal in exTop-Item, after grouping the item shows 0. What is the solution
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SingleSort = false; Grid1->AllowGroupBy = true; Grid1->SortBarVisible = true; Grid1->BackColorSortBar = Grid1->BackColor; Grid1->Columns->get_Item(TVariant(5))->SortOrder = Exgridlib_tlb::SortOrderEnum::SortAscending; Grid1->Columns->get_Item(TVariant(6))->FormatColumn = L"currency(value)"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_LockedItemCount(Exgridlib_tlb::VAlignmentEnum::exTop,1); long h = var_Items->get_LockedItem(Exgridlib_tlb::VAlignmentEnum::exTop,0); var_Items->set_ItemBackColor(h,RGB(240,240,240)); var_Items->set_CellBackColor(TVariant(h),TVariant(6),RGB(190,190,190)); var_Items->set_CellValue(TVariant(h),TVariant(6),TVariant("sum(all,rec,%6)")); var_Items->set_CellValueFormat(TVariant(h),TVariant(6),Exgridlib_tlb::ValueFormatEnum::exTotalField); Grid1->Refresh(); Grid1->EndUpdate(); |
935 |
I would like to avoid manual typing in the date-cell because user often type wrong things (no decimal points and so on) and so the todays-date is generated for the cell. What can be done
// KeyPress event - Occurs when the user presses and releases an ANSI key. void __fastcall TForm1::Grid1KeyPress(TObject *Sender,short * KeyAscii) { OutputDebugString( L"if .Editying != 0 then" ); OutputDebugString( PChar(Grid1->Editing) ); KeyAscii = 0; } Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Tasks"); Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"Date"); var_Column->Editor->EditType = Exgridlib_tlb::EditTypeEnum::DateType; var_Column->Width = 128; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 1"))),TVariant(1),TVariant(TDateTime(2006,9,21).operator double())); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 2"))),TVariant(1),TVariant(TDateTime(2015,12,22).operator double())); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 3"))),TVariant(1),TVariant(TDateTime(2015,1,10).operator double())); Grid1->EndUpdate(); |
934 |
The control does not ensure the item to fit the control's client area once the user clicks the cell's button or check box. What can be done
// MouseDown event - Occurs when the user presses a mouse button. void __fastcall TForm1::Grid1MouseDown(TObject *Sender,short Button,short Shift,int X,int Y) { // Items.EnsureVisibleItem(ItemFromPoint(-1,-1,c,hit)) } Grid1->BeginUpdate(); Grid1->TreeColumnIndex = -1; Grid1->SelForeColor = Grid1->ForeColor; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Buttons"); var_Column->Alignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasButton,TVariant(true)); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Button A")); var_Items->AddItem(TVariant("Button B")); var_Items->AddItem(TVariant("Button C")); Grid1->EndUpdate(); |
933 |
How do you save the index number from a drop down to a database
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->get_Item(TVariant("ShipVia")); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellBackColor,TVariant(15790320)); var_Column->Position = 1; var_Column->Width = 96; Exgridlib_tlb::IEditorPtr var_Editor = var_Column->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::DropDownListType; var_Editor->AddItem(1,L"Speedy Express",TNoParam()); var_Editor->AddItem(2,L"United Package",TNoParam()); var_Editor->AddItem(3,L"Federal Shipping",TNoParam()); Grid1->EndUpdate(); |
932 |
Is there a way to set the column width and have it stay when refreshing using the data source
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->Layout = TVariant(String("gBjAAwAAuABmABpABsAB0ABlAByhoAPIAOEPAA9gYABoABQAgUEg0XN4AOcJicKkpujIAGMcj0gjcGk8QhkQgUOjUEjsfkMFAB2lEnhRihcYjUvnsykQAO8oMkTNEtG") + "gAGUwn0uoEIhUMh0QiUOisXiE7rEyl8jAElokptYAllmpcCtMmjE3mU6jdzrUGoUKttGvFJs90oFPhVRh1Twg4wtaptco9fiMTsdIvcxw1Nkl2hUOlVwlsvnmayFAmtH" + "nETuWm0lAv+eAGCzFK10zp1QqVUAGOvkvuuSr0YsMUi2Y0tZ4FAztt0FvuNa23Kvt2m0YnMt5No6uxwOq0eP5cGxAAxQAxgAGwAqu/q1blHDsGW49lzPUq9qtko58r8K" + "rvc/LrPA7LWvw2ChpQ2j7Om7kBPK870hu+6ZQE4SJvmsT6u0x8BOa/iUP8jUANNATUrxAsKIFATvQU8DCL5B7dMWlr1u2gQZvgrsMMrDSyQ4vkcv02T+tEjUcyC1C7uw" + "1kVABISgwSosXq1JLyRm9EaycqqDQuyjisu+0bvY5i3udEMjTIvkuQHFEmzHNkWymwcqtNNkIN2jUbMeGsdMm4j6R/AyZT7IcztC6M+r5Qs2yYvUx0ZOTZypBqBUZPEa" + "Max71y6+MeTBDdBoFTjjv2z80Oi9a+VJE9HSA01SUlBbw1Ww8sPSqtFNNCdOx3L9AuQx9eVLIlUJbCa+WHVrV0fYUEMBF06UqAFh0xLLCT7abHV7P8MuNQUnW3YlDugl" + "rfNNcVlrzV6s3FWVKMfcVrPSq6rva0wcz8+Ue2/YK+XzQ0QUQlt83/JTr2ZdiZYBKNoTm2rH4ZedzSckqGDqAA2tEk7CSQmKEJKgWMY5CmQJlkaZYsAGMY0liFJYqKID" + "xhSpjCu0vUBQappOgSJZUhlBtTmyJIEqaBZVljRZe8yMZnoMl4SjQRI3qal3U7OjqPpOXNFmIAadCiHIkiDV6RjOla7puFKFnjK5/ta7Z6t6GIYkqEIQ1NmqWgIA="); Grid1->EndUpdate(); |
931 |
Is it possible to decode/view the control's Layout property
Grid1->BeginUpdate(); Grid1->SingleSort = false; Grid1->Columns->Add(L"C0"); Grid1->Columns->Add(L"C1")->SortOrder = Exgridlib_tlb::SortOrderEnum::SortAscending; Grid1->Columns->Add(L"C2"); /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: ExPrint 1.0 Control Library TypeLib: ExPrint.dll to define the namespace: Exprintlib_tlb */ //#include "EXPRINTLIB_TLB.h" Exprintlib_tlb::IExPrintPtr var_Print = Variant::CreateObject(L"Exontrol.Print"); OutputDebugString( var_Print->get_Decode64TextW(Grid1->Layout) ); Grid1->EndUpdate(); |
930 |
How do I programmatically sort by multiple columns
|
929 |
Do you have any Fit-To-Page options when printing the control (W x T, Fit-To )
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; Grid1->ContinueColumnScroll = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->EndUpdate(); /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: ExPrint 1.0 Control Library TypeLib: ExPrint.dll to define the namespace: Exprintlib_tlb */ //#include "EXPRINTLIB_TLB.h" Exprintlib_tlb::IExPrintPtr var_Print = Variant::CreateObject(L"Exontrol.Print"); var_Print->set_Options(TVariant("FitToPage =2 x 1")); var_Print->PrintExt = (IUnknown*)Grid1->DefaultDispatch; var_Print->Preview(); |
928 |
Do you have any Fit-To-Page options when printing the control ( x T, Fit-To Tall )
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; Grid1->ContinueColumnScroll = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->EndUpdate(); /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: ExPrint 1.0 Control Library TypeLib: ExPrint.dll to define the namespace: Exprintlib_tlb */ //#include "EXPRINTLIB_TLB.h" Exprintlib_tlb::IExPrintPtr var_Print = Variant::CreateObject(L"Exontrol.Print"); var_Print->set_Options(TVariant("FitToPage = x 2")); var_Print->PrintExt = (IUnknown*)Grid1->DefaultDispatch; var_Print->Preview(); |
927 |
Do you have any Fit-To-Page options when printing the control ( W x, Fit-To Wide )
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; Grid1->ContinueColumnScroll = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->EndUpdate(); /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: ExPrint 1.0 Control Library TypeLib: ExPrint.dll to define the namespace: Exprintlib_tlb */ //#include "EXPRINTLIB_TLB.h" Exprintlib_tlb::IExPrintPtr var_Print = Variant::CreateObject(L"Exontrol.Print"); var_Print->set_Options(TVariant("FitToPage = 2 x")); var_Print->PrintExt = (IUnknown*)Grid1->DefaultDispatch; var_Print->Preview(); |
926 |
Do you have any Fit-To-Page options when printing the control ( percent view, Adjust-To )
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; Grid1->ContinueColumnScroll = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->EndUpdate(); /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: ExPrint 1.0 Control Library TypeLib: ExPrint.dll to define the namespace: Exprintlib_tlb */ //#include "EXPRINTLIB_TLB.h" Exprintlib_tlb::IExPrintPtr var_Print = Variant::CreateObject(L"Exontrol.Print"); var_Print->set_Options(TVariant("FitToPage = 50%")); var_Print->PrintExt = (IUnknown*)Grid1->DefaultDispatch; var_Print->Preview(); |
925 |
How can I get notified once the user expands a column
// LayoutChanged event - Occurs when column's position or column's size is changed. void __fastcall TForm1::Grid1LayoutChanged(TObject *Sender) { OutputDebugString( L"Column-Expanded" ); OutputDebugString( PChar(Grid1->Columns->get_Item(TVariant("C0"))->Expanded) ); } Grid1->BeginUpdate(); Grid1->ShowFocusRect = false; Grid1->ColumnAutoResize = false; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exAllLines; Grid1->BackColorLevelHeader = Grid1->BackColor; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"C0"); var_Column->ExpandColumns = L"0,1,2"; var_Column->DisplayExpandButton = true; var_Columns->Add(L"C1"); var_Columns->Add(L"C2"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Cell 0.0")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant("Cell 0.1")); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("Cell 0.2")); h = var_Items->AddItem(TVariant("Cell 1.0")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant("Cell 1.1")); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("Cell 1.2")); Grid1->EndUpdate(); |
924 |
I am using expandable headers, the question is how I can display the column itself, not just the child columns
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exAllLines; Grid1->BackColorLevelHeader = Grid1->BackColor; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"C0"); var_Column->ExpandColumns = L"0,1,2"; var_Column->DisplayExpandButton = true; var_Columns->Add(L"C1"); var_Columns->Add(L"C2"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Cell 0.0")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant("Cell 0.1")); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("Cell 0.2")); h = var_Items->AddItem(TVariant("Cell 1.0")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant("Cell 1.1")); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("Cell 1.2")); Grid1->EndUpdate(); |
923 |
How do I layout expandable columns
Grid1->BeginUpdate(); Grid1->ColumnAutoResize = false; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exAllLines; Grid1->BackColorLevelHeader = Grid1->BackColor; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"C0"); var_Column->ExpandColumns = L"1,2"; var_Column->DisplayExpandButton = true; var_Columns->Add(L"C1"); var_Columns->Add(L"C2"); var_Columns->Add(L"C3"); Exgridlib_tlb::IColumnPtr var_Column1 = var_Columns->Add(L"C4"); var_Column1->ExpandColumns = L"5,6"; var_Column1->DisplayExpandButton = true; var_Columns->Add(L"C5"); Exgridlib_tlb::IColumnPtr var_Column2 = var_Columns->Add(L"C6"); var_Column2->ExpandColumns = L"6,7"; var_Column2->DisplayExpandButton = true; var_Columns->Add(L"C7"); Grid1->EndUpdate(); Grid1->Columns->get_Item(TVariant("C4"))->Expanded = false; |
922 |
How do I make the control read-only (method 2)
// Edit event - Occurs just before editing the focused cell. void __fastcall TForm1::Grid1Edit(TObject *Sender,Exgridlib_tlb::HITEM Item,long ColIndex,VARIANT_BOOL * Cancel) { Cancel = true; } Grid1->BeginUpdate(); Exgridlib_tlb::IEditorPtr var_Editor = Grid1->Columns->Add(L"Editor")->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::CheckListType; var_Editor->AddItem(1,L"One",TNoParam()); var_Editor->AddItem(2,L"Two",TNoParam()); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Check"); Exgridlib_tlb::IEditorPtr var_Editor1 = var_Column->Editor; var_Editor1->EditType = Exgridlib_tlb::EditTypeEnum::CheckValueType; var_Editor1->set_Option(Exgridlib_tlb::EditorOptionEnum::exCheckValue1,TVariant(2)); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(1))),TVariant(1),TVariant(0)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(2))),TVariant(1),TVariant(1)); Grid1->EndUpdate(); |
921 |
How do I set a locked check-box
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Locked-Check"); Exgridlib_tlb::IEditorPtr var_Editor = var_Column->Editor; var_Editor->EditType = Exgridlib_tlb::EditTypeEnum::CheckValueType; var_Editor->set_Option(Exgridlib_tlb::EditorOptionEnum::exCheckValue1,TVariant(2)); var_Editor->Locked = true; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Unlocked-Check"); Exgridlib_tlb::IEditorPtr var_Editor1 = var_Column1->Editor; var_Editor1->EditType = Exgridlib_tlb::EditTypeEnum::CheckValueType; var_Editor1->set_Option(Exgridlib_tlb::EditorOptionEnum::exCheckValue2,TVariant(1)); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(1))),TVariant(1),TVariant(0)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant(0))),TVariant(1),TVariant(1)); Grid1->EndUpdate(); |
920 |
Does the title of the cell's tooltip supports HTML format
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L""); var_Column->Caption = L""; var_Column->HTMLCaption = L"Column"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellToolTip(TVariant(var_Items->AddItem(TVariant("tooltip w/h different title"))),TVariant(0),TVariant(String("<c><b><fgcolor=FF0000>Title</fgcolor></b><br>This is bit of text that's shown when the user hovers the cell. This shows the tit") + "le centered with a different color.")); Grid1->EndUpdate(); |
919 |
How do I specify a different title for the cell's tooltip
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L""); var_Column->Caption = L"This is the title"; var_Column->HTMLCaption = L"Column"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellToolTip(TVariant(var_Items->AddItem(TVariant("tooltip w/h different title"))),TVariant(0),L"This is bit of text that's shown when the user hovers the cell."); Grid1->EndUpdate(); |
918 |
The cell's tooltip displays the column's caption in its title. How can I get ride of that
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"C1"); var_Columns->Add(L"C2"); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("tooltip w/h caption")); var_Items->set_CellToolTip(TVariant(h),TVariant(0),L"This is bit of text that's shown when the user hovers the cell. This shows the column's caption in the title."); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant("tooltip no caption")); var_Items->set_CellToolTip(TVariant(h),TVariant(1),L"This is bit of text that's shown when the user hovers the cell. This shows no column's caption in the title."); Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->get_Item(TVariant("C2")); var_Column->HTMLCaption = var_Column->Caption; var_Column->Caption = L""; Grid1->EndUpdate(); |
917 |
How can I programmatically show the column's filter
// RClick event - Fired when right mouse button is clicked void __fastcall TForm1::Grid1RClick(TObject *Sender) { long i = Grid1->ItemFromPoint[-1,-1,c,hit]; Grid1->Columns->get_Item(TVariant(c))->ShowFilter(TVariant("-1,-1,128,128")); } Grid1->BeginUpdate(); Grid1->ShowFocusRect = false; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Items "); var_Column->DisplayFilterPattern = false; var_Column->FilterList = Exgridlib_tlb::FilterListEnum::exShowExclude | Exgridlib_tlb::FilterListEnum::exShowFocusItem | Exgridlib_tlb::FilterListEnum::exShowCheckBox; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Item 1")); var_Items->AddItem(TVariant("Item 2")); var_Items->AddItem(TVariant("Item 3")); Grid1->EndUpdate(); |
916 |
I want to be able to click on one of the headers, and sort by other column. How can I do that (method 2)
// ColumnClick event - Fired after the user clicks on column's header. void __fastcall TForm1::Grid1ColumnClick(TObject *Sender,Exgridlib_tlb::IColumn *Column) { // Column.SortOrder = 1 Grid1->SortOnClick = Exgridlib_tlb::SortOnClickEnum::exDefaultSort; Grid1->Columns->get_Item(TVariant("Sort"))->SortOrder = Exgridlib_tlb::SortOrderEnum::SortAscending; Grid1->SortOnClick = Exgridlib_tlb::SortOnClickEnum::exUserSort; } Grid1->BeginUpdate(); Grid1->SortOnClick = Exgridlib_tlb::SortOnClickEnum::exUserSort; Grid1->Columns->Add(L"Items"); Grid1->Columns->Add(L"Sort")->Visible = false; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 1 (3)"))),TVariant(1),TVariant(3)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 2 (1)"))),TVariant(1),TVariant(1)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 3 (2)"))),TVariant(1),TVariant(2)); Grid1->EndUpdate(); |
915 |
I want to be able to click on one of the headers, and sort by other column. How can I do that (method 1)
// ColumnClick event - Fired after the user clicks on column's header. void __fastcall TForm1::Grid1ColumnClick(TObject *Sender,Exgridlib_tlb::IColumn *Column) { // Column.SortOrder = 1 Grid1->Items->SortChildren(0,TVariant("Sort"),true); } Grid1->BeginUpdate(); Grid1->SortOnClick = Exgridlib_tlb::SortOnClickEnum::exUserSort; Grid1->Columns->Add(L"Items"); Grid1->Columns->Add(L"Sort")->Visible = false; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 1 (3)"))),TVariant(1),TVariant(3)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 2 (1)"))),TVariant(1),TVariant(1)); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("Item 3 (2)"))),TVariant(1),TVariant(2)); Grid1->EndUpdate(); |
914 |
How can I highlight the cell's button with a different appearance, when cursor hovers it
Grid1->BeginUpdate(); Grid1->VisualAppearance->Add(1,TVariant("c:\\exontrol\\images\\normal.ebn")); Grid1->DefaultItemHeight = 22; Grid1->TreeColumnIndex = -1; Grid1->SelForeColor = RGB(0,0,0); Grid1->SelBackColor = Grid1->BackColor; Grid1->Background[Exgridlib_tlb::BackgroundPartEnum::exCursorHoverCellButton] = 0x1000000; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Buttons"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasButton,TVariant(true)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column->Alignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; var_Column->HeaderAlignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Button <b>1</b>")); var_Items->AddItem(TVariant("Button <b>2</b>")); var_Items->AddItem(TVariant("Button <b>3</b>")); Grid1->EndUpdate(); |
913 |
How can I prevent highlighting the cell's button while cursor hovers it
// AddItem event - Occurs after a new Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(Item),TVariant(0),TVariant("Button <b>A</b>")); var_Items->set_CellValue(TVariant(Item),TVariant(1),TVariant("Button <b>B</b>")); } Grid1->BeginUpdate(); Grid1->DefaultItemHeight = 22; Grid1->TreeColumnIndex = -1; Grid1->SelForeColor = RGB(0,0,0); Grid1->SelBackColor = Grid1->BackColor; Grid1->Background[Exgridlib_tlb::BackgroundPartEnum::exCursorHoverCellButton] = -1; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"A"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasButton,TVariant(true)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column->Alignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; var_Column->HeaderAlignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"B"); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasButton,TVariant(true)); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); var_Column1->Alignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; var_Column1->HeaderAlignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; Grid1->Columns->Add(L"")->Position = 1; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellEnabled(TVariant(var_Items->AddItem(TVariant(""))),TVariant(1),false); var_Items->AddItem(TVariant("")); var_Items->AddItem(TVariant("")); Grid1->EndUpdate(); |
912 |
How can I change the image of the icon while performing OLE Drag and Drop
// OLEStartDrag event - Occurs when the OLEDrag method is called. void __fastcall TForm1::Grid1OLEStartDrag(TObject *Sender,Exgridlib_tlb::IExDataObject *Data,long * AllowedEffects) { // Data.SetData("your data to drag") AllowedEffects = 2; } Grid1->BeginUpdate(); Grid1->OLEDropMode = Exgridlib_tlb::exOLEDropModeEnum::exOLEDropManual; Grid1->ColumnAutoResize = false; Grid1->DefaultItemHeight = 22; Grid1->HeaderHeight = Grid1->DefaultItemHeight; Grid1->Columns->Add(L"Default")->Width = 128; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Item 1")); var_Items->AddItem(TVariant("Item 2")); var_Items->AddItem(TVariant("Item 3")); var_Items->AddItem(TVariant("Item 4")); var_Items->AddItem(TVariant("Item 5")); Exgridlib_tlb::IAppearancePtr var_Appearance = Grid1->VisualAppearance; var_Appearance->Add(1,TVariant(String("gBFLBCJwBAEHhEJAAChABakMACAADACAxRDQNABQKAAzQFAYaBiG6GAAGEaRYgmFgAQhFcZQSKUOQTDKMIziYBYfgkMIgSbJUgDGAkRRdDSOYDmGQYDiCIoRShOMIjH") + "LUXxtDaIZwhEAoJb+RgAUY/cTzaAEUwHHiTKInaCQIhsC4JUJAdRURQ9EwvCIZBpEWwLChENQwWLCNj2TScBwjCyqbale45ViqdoDU8lORLUi+M4zSBPcZVTRtGShPDB" + "KTjMLaYgkIIlVpRNa0PC1GTzQ6mazkKQLRADDIDVbAeL3LiMBy9LyLLItQALByua5mWhbcZyBCOPgBTrRb5zO58FjuTK7YLjMB7NrUNYtFaUMy2OpOCADIaecTNcaWLx" + "PF2MY1HWYxVj2Jw3DuRJonKYB5lKAYkkYdA6hyDIjBkApaFoAAhBMfYxiGNAkFECZnm4YQBgiOgDl2URSE4KAEj2AJKigFgGgGYIIAyPQ6CCRogAAOxhAMSgSDgIRDhY" + "FoFmGCBmBQOAMjgdgQDsUITEIIg5iISAEmIOBigiJgqgqYhoFyVILyyMgyDmYxDg4rBjgiZg6g0Dh4kiTIMGMKAwmgOQkEkFhGhGZIJAoPoQAyQ4mE6BhlAkRgXhODoZ" + "C0A4Pg6KRmCSFplkkdheDmJYTioVgACOY4uGaDwmgmJhqg8JlWmOGRmGkChyhyZxJAobYbmMI4yHqFQnkmdh+2RYp4DMIZ5gaBohmiCYGB+IJOmoNhtiPXZGG2I1tgyb" + "4lmgGhmhqJt0Fyb4gk8CtsCiahKhYH4oXiAohiUKpKjaLt+goDJxiyaZqlaNot4OTJx3gKp2iiL5sAsBoov+KgMnOMZrisJpKjLjocnPeBLEaRI0m0SxWkSNBPEoDJ1j" + "abJrHaXo35obOZC2OximaOZugsYpi3ga42mKO5vAuRpijsTxqAyd49m8S5mnqPuqFyd4gk+DAGn6QJwEwFp+kAT+BnmQpwgwNwOkPtYsnnrgsFcEpFnGDBnBKRRPiwUw" + "ckecgMgcIpHGMKQwnuSZygyJ1/HKOgMnyS5zAyRwykycw5g4Eg0jCA57DqTpzkydw+kIDR9AUCY9A2HQXBIUh0g0JRJ5aUxmnQZIPnkUgvDUI5tFcVoPjUOB+A4QBAIC" + "A")); var_Appearance->Add(2,TVariant(String("gBFLBCJwBAEHhEJAAChABC8MACAADACAxRDQNABQKAAzQFAYaBiG6GAAGEaRYgmFgAQhFcZQSKUOQTDKMIziaQIRDINQlSTJcQjKKEUQTFiXIyAKKwEgmEQMQiCcbzX") + "IUBxAAqXZZFUaKAgOMJDTLBAzUTCQbR7HiQYyBeCQOo+VoaSACEIlAZJRjoOo5DJGGQILlQJqyYrpaAxIgkEJuTqGoQaXgle53PJeLpXW5Nez9P7AMBwK7bbaqeTyXa+" + "eDtJhif4cXjIMhyLI8UxXEKOL7jDSYPgqK48QhCEJQPQ9EyXJqnahoemCeRXBZ+aqxbBsCwCep0YBeNr3HaNaz3PK/brtWxMDpeA5IYhhF7WdZFR4tMrOdAtHL9FyPJ5" + "TFicgXnoTAKAsRpHPeVhrAUd4LkmY5yj+fQ+i8L4zk+Y5vjCe4oD6ZoNhSRxiisVRKg+T5vnWfB6h6J5yAIf4fieWJFHyHZHHSTAygyAociMKBKEKBIeCiCZyHYFAnCA" + "B4mBeBQJlgRIegOCgYCySAgh2WAkgINAMmMNIgCcCYoGYLoLmKaIshqCgMliEICgmDRDEiUQmkmAhWDCD5inicIVg4TQYloJg2g2ExYhoJZJEidIThMCQSFyEwkGKaRK" + "FEJQJBkOhLCUJIDFoRiKBmBJhDeDZZDoPAlgmQhghaGZimmHhphqZopDoYw3GYEgFgGHROGOFJkCSSQCDoTAkiSaQ6C6IBJFkPIUCSJ5CDoeQ5CcVZ5gWHROmONJsCMS" + "ISByEFyjIRoYiaKYaG6HonEiOhcguJQIHoRJsh0WBWB2JIpiqShKi0OwqnqRouiyTpGhGBxiYIZKOhqGp2j4aRaAqZL3FAECAgA==")); Grid1->Background[Exgridlib_tlb::BackgroundPartEnum::exDragDropBefore] = 0x1000000; Grid1->Background[Exgridlib_tlb::BackgroundPartEnum::exDragDropAfter] = 0x2000000; Grid1->Background[Exgridlib_tlb::BackgroundPartEnum::exDragDropForeColor] = RGB(0,0,1); Grid1->EndUpdate(); |
911 |
How can I sort by two-columns, one by date and one by time
Grid1->BeginUpdate(); Grid1->SingleSort = false; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Index")->FormatColumn = L"1 index ``"; var_Columns->Add(L"Date")->SortType = Exgridlib_tlb::SortTypeEnum::SortDate; Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"Time"); var_Column->SortType = Exgridlib_tlb::SortTypeEnum::SortTime; var_Column->FormatColumn = L"time(value)"; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant(0)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2001,1,1).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(TDateTime(2001,1,1,10,00,00,0).operator double())); h = var_Items->AddItem(TVariant(0)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2000,12,31).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(TDateTime(2001,1,1,10,00,00,0).operator double())); h = var_Items->AddItem(TVariant(0)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2001,1,1).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(TDateTime(2001,1,1,6,00,00,0).operator double())); h = var_Items->AddItem(TVariant(0)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2000,12,31).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(TDateTime(2001,1,1,8,00,00,0).operator double())); h = var_Items->AddItem(TVariant(0)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2001,1,1).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(TDateTime(2001,1,1,8,00,00,0).operator double())); h = var_Items->AddItem(TVariant(0)); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant(TDateTime(2000,12,31).operator double())); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant(TDateTime(2001,1,1,6,00,00,0).operator double())); Grid1->Layout = L"multiplesort=\"C1:1 C2:1\""; Grid1->EndUpdate(); |
910 |
How can I display a context menu
// MouseUp event - Occurs when the user releases a mouse button. void __fastcall TForm1::Grid1MouseUp(TObject *Sender,short Button,short Shift,int X,int Y) { /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: ExContextMenu 1.0 Type Library TypeLib: ExContextMenu.dll to define the namespace: Excontextmenulib_tlb */ //#include "EXCONTEXTMENULIB_TLB.h" Excontextmenulib_tlb::IExContextMenuPtr var_ExContextMenu = Variant::CreateObject(L"Exontrol.ContextMenu"); var_ExContextMenu->Items->ToString = L"Check[chk],[sep],Item 1,Item 2,Item 3"; OutputDebugString( PChar(var_ExContextMenu->Select(TNoParam(),TNoParam(),TNoParam())) ); } Grid1->ColumnAutoResize = false; Grid1->ScrollBySingleLine = true; Grid1->ContinueColumnScroll = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->ReadOnly = Exgridlib_tlb::ReadOnlyEnum::exReadOnly; |
909 |
Also, are there any plans on the ability to put borders on individual cells or rows or columns
Grid1->BeginUpdate(); Exgridlib_tlb::IAppearancePtr var_Appearance = Grid1->VisualAppearance; var_Appearance->Add(1,TVariant(String("gBFLBCJwBAEHhEJAAChABOUGACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgFgmEQxDANIBQSKoaQiGQYRhkEYgEiONoaDJCM4wH") + "IMQxHCKTZRkGYpajOPobUbGUywHRcRRvH6EZQGWg6GjqK43SCEEZhJBNGyTJ6BZbGURbCqSLAwWZAYy2RCMRxDJqLKypSwKPoGKosS5OUwzHItaRtHaJJAwKZ6ApGQpR" + "VTAYxVfC1PzkACma4nS7oXraVJFVZTdYwTh+JABTzGLpnKw7FhGa5pABpdq0RTuOZdAbPMoyXBrXqqB46UCOGg5HRWWwHR7ZIquap9JzfCq5cRbWr5BBOPaBYKwdD1CB" + "+iMVRnlQRY4hafZwAMH5Pl4XQnjCEBECSIBpDGHQOicIwtBIBpmiWEIJj6eJQloEgomafgyGGCI6kKYZQH+igGAKAJgEgFgGgGYIFlCf4CmCSA2A6A5hAgRgEgQYRIFY" + "FIEmEaBmBmBghigdgQgcIZogYC4ICIKB6CSCRhiiHgogWIooi4F4AmKaIaDCDBihiTg0gsIIYmYOoOmOSJ2D6AZQBAgI=")); var_Appearance->Add(2,TVariant(String("gBFLBCJwBAEHhEJAAChABdUIQAAYAQGKIaBoAKBQAGaAoDDYMg1QwAAxDGLEEwsACEIrjKCVIgkHYJRjGEZxNCMIhiGAaQChEZYHgkMomDAOEgyHKcEgJGyEQgkOa4a") + "jCKYrSzAcrwTI4cRVHiQZygOZ4DBSOY8VBAcQweItJhrKqVRgriitNQjCyjZCpOaIDooAJmRZNNISBBIEQSKA0TDOQ5TSKUMYhOZTBBEbbMNBtBIUIRpajbMBiFywUxU" + "OJYXhmG4dR7IMhyLI8UxXFo7P7mOZZXjmO49T7Kc70LQ9CyHJKnabpWoaXj2VZZV7Mda2DTNSzPKK1bZpG4bTouKZ5WjfN72fgeCzrF7HchyPJcXxnG4ZAMBA")); var_Appearance->Add(3,TVariant(String("gBFLBCJwBAEHhEJAAChABL0GACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgEgmEQxDANIBQSKoaQiGQYRhkEYpFiONoXDJCM4wH") + "IMQxHCKTZRkGYpajOPobUbGUygBRdExvEyEZQGWg6GjqK43SCEEZhJBNGyfH6dBpEWT7ChENQwWLLFoRDIcQyXCytIDter4boGKosS5OUwzGAtaRvHaJJAwKZ6ApGQpR" + "VTAYxUdC1HTjJiEa4nS7oXraVJFVZTdYwTh+JABTzGKbsSycKqWaqkABZeoWbTuOZdAbPMoyXBrXgOLYzUCOGg5HRWWwHR7ZIq0Pg9Hqaa4bVbIVxbcAGH6BQa6J5hEB" + "ECSIBpDGHQOicIwtBIBpmhqEIJj2eJQloEgokiegyGGCI6kKZ5BnefA+D8L4flOa52nufg+g+f5fnPFB/ooBZ1omSAWASAJgGgJgJgIIIoDYAIDCCaBFnuBAhCgOgUgU" + "YIoF4GIBiGKBuAcfohmgNgdggX54g4JB/F+GImCqCpikiNguguUAQICA=")); var_Appearance->Add(4,TVariant(String("gBFLBCJwBAEHhEJAAChABBUGACAADACAxRDQNABQKAAzQFAYbBkGqGAAGIYxYgmFgAQhFcZQSpEEg7BKMYwjOJgCgmEQxDANMiwGKoaQiGQYRhkEYgFiONoaDJCM4wH") + "IMQxHCKTZRkGYpajOPobUbAYQQSAkEgpECbZqoEZaDoaOorTZINJ0VR1Ox5KKfZyGURZPqOEQ1DBZEI2RZUbxDJquLhACj7AjeZZtRJZVp2TY9eQ3LC3aYhGqwAwSFpJ" + "VjUEBgRBJIDSMY6DpOIxaEgNZpwEITOTxUK0EhRLy5agDCJ1QrCdanahqOpaXpmW5dV7YNh2LTnfzXNq3bhuO5bXqOd59X7fN54Dg+D4LRLHbpxXIcXqvFaZZDnOb4To" + "PEuAZUmqcB2B2DoHGuN5Tm6d46lsPwfhOS5mnOeg9DqCAIICA")); Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exGroupLinesAtRoot; Grid1->SelBackColor = Grid1->BackColor; Grid1->SelForeColor = Grid1->ForeColor; Grid1->DefaultItemHeight = 22; Grid1->Columns->Add(L""); Grid1->Columns->Add(L"")->set_Def(Exgridlib_tlb::DefColumnEnum::exCellBackColor,TVariant(33554432)); Grid1->Columns->Add(L""); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Root 1")); var_Items->set_ItemBackColor(h,0x1000000); TVariant hx = TVariant(var_Items->get_SplitCell(TVariant(h),TVariant(0))); var_Items->set_CellValue(TVariant(0),TVariant(hx),TVariant("count(current,dir,1)")); var_Items->set_CellValueFormat(TVariant(0),TVariant(hx),Exgridlib_tlb::ValueFormatEnum::exTotalField); var_Items->set_FormatCell(TVariant(0),TVariant(hx),L"'Childs: ' + value"); var_Items->set_CellBackColor(TVariant(0),TVariant(hx),0x3000000); var_Items->set_CellHAlignment(TVariant(0),TVariant(hx),Exgridlib_tlb::AlignmentEnum::CenterAlignment); var_Items->InsertItem(h,TNoParam(),TVariant("Child 1")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 2")); var_Items->set_ExpandItem(h,true); h = var_Items->AddItem(TVariant("Root 2")); var_Items->set_ItemBackColor(h,0x4000000); hx = TVariant(var_Items->get_SplitCell(TVariant(h),TVariant(0))); var_Items->set_CellValue(TVariant(0),TVariant(hx),TVariant("count(current,dir,1)")); var_Items->set_CellValueFormat(TVariant(0),TVariant(hx),Exgridlib_tlb::ValueFormatEnum::exTotalField); var_Items->set_FormatCell(TVariant(0),TVariant(hx),L"'Childs: ' + value"); var_Items->set_CellBackColor(TVariant(0),TVariant(hx),0x3000000); var_Items->set_CellHAlignment(TVariant(0),TVariant(hx),Exgridlib_tlb::AlignmentEnum::CenterAlignment); var_Items->InsertItem(h,TNoParam(),TVariant("Child 1")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 2")); var_Items->InsertItem(h,TNoParam(),TVariant("Child 3")); var_Items->set_ItemBackColor(var_Items->InsertItem(h,TNoParam(),TVariant("Child 4")),0x4000000); Grid1->EndUpdate(); |
908 |
How can I decode the Layout property
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"C1"); var_Columns->Add(L"C2")->Position = 1; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("SubItem 1.1"))),TVariant(1),TVariant("SubItem 1.2")); var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("SubItem 2.1"))),TVariant(1),TVariant("SubItem 2.2")); Grid1->Columns->get_Item(TVariant("C2"))->SortOrder = Exgridlib_tlb::SortOrderEnum::SortDescending; Grid1->EndUpdate(); OutputDebugString( L"Encoded:" ); OutputDebugString( Grid1->Layout ); /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: ExPrint 1.0 Control Library TypeLib: ExPrint.dll to define the namespace: Exprintlib_tlb */ //#include "EXPRINTLIB_TLB.h" Exprintlib_tlb::IExPrintPtr var_Print = Variant::CreateObject(L"Exontrol.Print"); OutputDebugString( L"Decoded: " ); OutputDebugString( var_Print->get_Decode64TextW(Grid1->Layout) ); |
907 |
No new line is shown if using <br> tag. How can I show a new line with-in the cell
Grid1->BeginUpdate(); Grid1->ScrollBySingleLine = true; Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"Single-Line"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(true)); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->Add(L"Multiple-Lines"); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(false)); var_Column1->set_Def(Exgridlib_tlb::DefColumnEnum::exCellValueFormat,TVariant(1)); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->set_CellValue(TVariant(var_Items->AddItem(TVariant("First-Line<br>Second-Line"))),TVariant(1),TVariant("First-Line<br>Second-Line")); long h = var_Items->AddItem(TVariant("First-Line<br>Second-Line<br>Third-Line")); var_Items->set_CellSingleLine(TVariant(h),TNoParam(),Exgridlib_tlb::CellSingleLineEnum::exCaptionWordWrap); var_Items->set_CellHAlignment(TVariant(h),TVariant(0),Exgridlib_tlb::AlignmentEnum::CenterAlignment); var_Items->set_ItemDivider(h,0); Grid1->EndUpdate(); |
906 |
I am using exCRD to layout the columns in the grid, but is there a way where I can have the text in a cell wrap if it's exceeds the width of the cell instead of showing the ...'s
Grid1->BeginUpdate(); Grid1->DrawGridLines = Exgridlib_tlb::GridLinesEnum::exRowLines; Grid1->DefaultItemHeight = 36; Grid1->FullRowSelect = Exgridlib_tlb::CellSelectEnum::exColumnSel; Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"Column1"); var_Column->Visible = false; var_Column->Editor->EditType = Exgridlib_tlb::EditTypeEnum::EditType; Exgridlib_tlb::IColumnPtr var_Column1 = var_Columns->Add(L"Column2"); var_Column1->Visible = false; var_Column1->Editor->EditType = Exgridlib_tlb::EditTypeEnum::EditType; Exgridlib_tlb::IColumnPtr var_Column2 = var_Columns->Add(L"Column3"); var_Column2->Visible = false; var_Column2->set_Def(Exgridlib_tlb::DefColumnEnum::exCellSingleLine,TVariant(false)); var_Column2->Editor->EditType = Exgridlib_tlb::EditTypeEnum::EditType; Exgridlib_tlb::IColumnPtr var_Column3 = var_Columns->Add(L"Column4"); var_Column3->Alignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; var_Column3->HeaderAlignment = Exgridlib_tlb::AlignmentEnum::CenterAlignment; var_Column3->Visible = false; var_Column3->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasButton,TVariant(true)); var_Column3->set_Def(Exgridlib_tlb::DefColumnEnum::exCellButtonAutoWidth,TVariant(true)); Exgridlib_tlb::IColumnPtr var_Column4 = var_Columns->Add(L"FormatLevel"); var_Column4->FormatLevel = L"(0/1),\"Information to be shown on the control's header\"[a=17][ww]:128,3:128"; var_Column4->set_Def(Exgridlib_tlb::DefColumnEnum::exCellFormatLevel,TVariant("(0/1),2[a=17][ww]:128,3:128")); Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Cell 1.1")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant("Cell 1.2")); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("This is just a bit of information on first row")); var_Items->set_CellValue(TVariant(h),TVariant(3),TVariant("Cell 1.4")); var_Items->set_CellSingleLine(TVariant(h),TVariant(3),Exgridlib_tlb::CellSingleLineEnum::exCaptionWordWrap); h = var_Items->AddItem(TVariant("Cell 2.1")); var_Items->set_CellValue(TVariant(h),TVariant(1),TVariant("Cell 2.2")); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("This is just a bit of information on second row")); var_Items->set_CellValue(TVariant(h),TVariant(3),TVariant("Cell 2.4")); Grid1->EndUpdate(); |
905 |
How can I load pictures using URL ( http:// )
|
904 |
How can I filter programmatically by multiple columns
Grid1->BeginUpdate(); Exgridlib_tlb::IColumnsPtr var_Columns = Grid1->Columns; var_Columns->Add(L"Name"); Exgridlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"Active"); var_Column->set_Def(Exgridlib_tlb::DefColumnEnum::exCellHasCheckBox,TVariant(true)); var_Column->DisplayFilterButton = true; var_Columns->Add(L"Type"); var_Columns->Add(L"Mode")->FilterType = Exgridlib_tlb::FilterTypeEnum::exFilter; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long h = var_Items->AddItem(TVariant("Item A")); var_Items->set_CellState(TVariant(h),TVariant(1),1); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("A")); h = var_Items->AddItem(TVariant("Item B")); var_Items->set_CellState(TVariant(h),TVariant(1),0); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("B")); h = var_Items->AddItem(TVariant("Item C")); var_Items->set_CellState(TVariant(h),TVariant(1),1); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("C")); var_Items->set_CellValue(TVariant(h),TVariant(3),TVariant("None")); h = var_Items->AddItem(TVariant("Item D")); var_Items->set_CellState(TVariant(h),TVariant(1),1); var_Items->set_CellValue(TVariant(h),TVariant(2),TVariant("C")); Exgridlib_tlb::IColumnPtr var_Column1 = Grid1->Columns->get_Item(TVariant(1)); var_Column1->FilterType = Exgridlib_tlb::FilterTypeEnum::exCheck; var_Column1->Filter = L"1"; Exgridlib_tlb::IColumnPtr var_Column2 = Grid1->Columns->get_Item(TVariant(2)); var_Column2->FilterType = Exgridlib_tlb::FilterTypeEnum::exFilter; var_Column2->Filter = L"C"; Exgridlib_tlb::IColumnPtr var_Column3 = Grid1->Columns->get_Item(TVariant(3)); var_Column3->FilterType = Exgridlib_tlb::FilterTypeEnum::exNonBlanks; Grid1->ApplyFilter(); Grid1->EndUpdate(); |
903 |
How can I add Right-To-Left Reading-Order / RTL Layout
Grid1->BeginUpdate(); Grid1->TreeColumnIndex = -1; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->Add(L"RTL - Header Caption"); var_Column->HeaderAlignment = Exgridlib_tlb::AlignmentEnum(0x20000 | Exgridlib_tlb::AlignmentEnum::RightAlignment); var_Column->Alignment = Exgridlib_tlb::AlignmentEnum(0x20000 | Exgridlib_tlb::AlignmentEnum::RightAlignment); Grid1->FullRowSelect = Exgridlib_tlb::CellSelectEnum::exColumnSel; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("RTL - Text Right")); var_Items->set_CellHAlignment(TVariant(var_Items->AddItem(TVariant("RTL - Text Center"))),TVariant(0),Exgridlib_tlb::AlignmentEnum(0x20000 | Exgridlib_tlb::AlignmentEnum::CenterAlignment)); var_Items->set_CellHAlignment(TVariant(var_Items->AddItem(TVariant("RTL - Text Left"))),TVariant(0),Exgridlib_tlb::AlignmentEnum(0x20000)); Grid1->EndUpdate(); |
902 |
I have applied ebn to the grid using the following code, and noticed that it applies to the filter dropdownList too. Is there a way to prevent this behavior, like keeping the Filter dropdownlist intact
Grid1->VisualAppearance->Add(1,TVariant("c:\\exontrol\\images\\normal.ebn")); Grid1->Appearance = Exgridlib_tlb::AppearanceEnum(0x1000000); Grid1->BackColorHeader = 0x1000000; Grid1->Background[Exgridlib_tlb::BackgroundPartEnum::exBackColorFilter] = 0x8000000f; Grid1->Columns->Add(L"Filter")->DisplayFilterButton = true; Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; var_Items->AddItem(TVariant("Item 1")); var_Items->AddItem(TVariant("Item 2")); |
901 |
The tree lines from the group parent to its children are missing and no identation is present: the parent and all its children are on the same offset from left. What canbe done
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection. void __fastcall TForm1::Grid1AddGroupItem(TObject *Sender,Exgridlib_tlb::HITEM Item) { Exgridlib_tlb::IItemsPtr var_Items = Grid1->Items; long nGroupColumn = var_Items->get_GroupItem(Item); var_Items->set_ItemDivider(Item,-1); var_Items->set_FormatCell(TVariant(Item),TVariant(0),var_Items->get_FormatCell(TVariant(Item),TVariant(nGroupColumn))); var_Items->set_CellValue(TVariant(Item),TVariant(0),TVariant(Grid1->Columns->get_Item(TVariant(nGroupColumn))->GroupByTotalField)); var_Items->set_CellValueFormat(TVariant(Item),TVariant(0),var_Items->get_CellValueFormat(TVariant(Item),TVariant(nGroupColumn))); } Grid1->BeginUpdate(); Grid1->ReadOnly = Exgridlib_tlb::ReadOnlyEnum::exReadOnly; Grid1->ColumnAutoResize = false; /* Select the Component\Import Component...\Import a Type Library, to import the following Type Library: Microsoft ActiveX Data Objects 6.1 Library TypeLib: msado15.dll to define the namespace: Adodb_tlb */ //#include "ADODB_TLB.h" Adodb_tlb::_RecordsetPtr rs = Variant::CreateObject(L"ADOR.Recordset"); rs->Open(TVariant("Orders"),TVariant("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Exontrol\\ExGrid\\Sample\\Access\\misc.accdb"),Adodb_tlb::CursorTypeEnum::adOpenStatic,Adodb_tlb::LockTypeEnum::adLockOptimistic,0); Grid1->DataSource = (IDispatch*)rs; Grid1->SortBarVisible = true; Grid1->SortBarCaption = L"Drag a <b>column</b> header here to group by that column."; Grid1->AllowGroupBy = true; Exgridlib_tlb::IColumnPtr var_Column = Grid1->Columns->get_Item(TVariant(0)); var_Column->AllowGroupBy = false; var_Column->Width = 96; Grid1->Columns->get_Item(TVariant(1))->SortOrder = Exgridlib_tlb::SortOrderEnum::SortAscending; Grid1->LinesAtRoot = Exgridlib_tlb::LinesAtRootEnum::exLinesAtRoot; Grid1->EndUpdate(); |